开发者

Scope of System.setProperty

What's the scop开发者_StackOverflow中文版e of System.setProperty in Android?

If I set a property (say System.setProperty("http.keepAlive", "false")), does it affect all apps in the system, the current app, the current task or the current thread only?

Where is this documented?


Java "system" properties do not cross process boundaries, they are held in memory and are tied to a single instance of the virtual machine. Therefore if you set a system property within application it will not be visible to other applications running on the device.


Android Activities of the same application, if you don't specify otherwise in the Manifest.xml, will run in a default Process created for the application when it starts.

Each process runs in its own JVM. So the System.setProperty(), based on @mmccomb 's answer, will reach all Activities in the same Application except if you, on pupose, declare Activities to run in different Processes.

See http://developer.android.com/guide/components/processes-and-threads.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜