I have a big chunk of third-party native code that I'm running on Android using the NDK. This code contains global variables, and as such only supports a single session per process. (Unless Android has some magic way of loading multiple instances of a shared library into the same process.)
I have to be able to run multiple Activi开发者_JAVA百科ties concurrently. This means that each Activity has to run in a different process. Does anyone know any way I can do this?
Note that process affinity doesn't help here, is this allows me to specify a single named process that all instances of a single Activity class run inside. What I want here is to have multiple instances of an Activity class each running in their own process.
I'm on Gingerbread (or above); I'm willing to consider any foul hack to make this work...
(Also: at the risk of sounding tetchy, please do not explain to me why this is a bad idea and I should do something else. Telling me that my external requirements are wrong isn't helping me meet my external requirements...)
You have to set both, android:taskAffinity and android:process in your manifest file for activities you wish launch in different processes.
How about this
android:multiprocess = true
check the docs. This should work.
精彩评论