开发者

Scope of System.setProperty

开发者 https://www.devze.com 2023-01-31 12:51 出处:网络
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

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

精彩评论

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