问题
I want to run two processes in the same DalvikVM. This means that I want to run a first app and then that this app starts the second app. And I want that this two apps are then running in the same DalvikVM. I think it is possible if the first app forks an process for the second app. But I´m not sure how can I do that. Thanks
回答1:
I want to run two processes in the same DalvikVM.
By definition, that is impossible.
This means that I want to run a first app and then that this app starts the second app. And I want that this two apps are then running in the same DalvikVM.
By definition, that is impossible.
I think it is possible if the first app forks an process for the second app.
No.
回答2:
I very much doubt what you actually want to do is go digging into the specifics of processes (if you do I would question why). In any case, Android deliberately makes it very difficult for you to go near processes as the platform provides sufficient mechanisms to achieve virtually any functional flow without needing to.
I suspect what you actually mean is you need to start a new Android task (has it's own back stack, functionally operates like a separate application).
Have a read of the Tasks and Back Stack document from the dev guide, particularly the section on tasks. What you probably want to look at is starting your new activity using the FLAG_ACTIVITY_NEW_TASK flag in the Intent.
来源:https://stackoverflow.com/questions/8970342/android-how-to-fork-a-new-process