首页 > 解决方案 > How can I start a new activity within a separate process without losing onActivityResult callback?

问题描述

I want to start a new activity in a separate android process by defining it as android:process=":processname" inside AndroidManifest.xml. However, I need to return a response to the caller activity. So, I need to start this activity through startActivityForResult(intent, requestCode) instead of startActivity(intent).

However, when I do not add intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), the new Activity won't start in a new process. When I add this flag, onActivityResult callback method of the caller Activity is not called. To sum up, my main aim is to separate activities within different processes so that the newly pushed activity should not decrease the performance (FPS value, for instance) of the caller Activity. Besides, the caller one should get a response from the newly pushed activity after it is destroyed which collides with the flag usage.

标签: androidandroid-intentandroid-activityandroid-task

解决方案


推荐阅读