Android:如何分叉新进程
我想在同一个 DalvikVM 中运行两个进程。这意味着我想运行第一个应用程序,然后该应用程序启动第二个应用程序。我希望这两个应用程序在同一个 DalvikVM 中运行。我认为如果第一个应用程序为第二个应用程序分叉一个进程,这是可能的。但我不确定我该怎么做。 谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据定义,这是不可能的。
根据定义,这是不可能的。
不。
By definition, that is impossible.
By definition, that is impossible.
No.
我非常怀疑你真正想做的是深入研究流程的细节(如果你这样做,我会质疑为什么)。无论如何,Android 故意让您很难接近进程,因为该平台提供了足够的机制来实现几乎任何功能流程,而无需这样做。
我怀疑你真正的意思是你需要启动一个新的Android任务(有它自己的返回堆栈,功能上像一个单独的应用程序一样运行)。
阅读任务和返回堆栈开发指南中的文档,特别是有关任务的部分。您可能想要查看的是使用 FLAG_ACTIVITY_NEW_TASKIntent 中的 a> 标志。
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
.