我有一个 Activity,它基本上是我的主要 Activity,它的启动模式是单实例。但是由于 singleInstance,onActivityResult()
回调不会触发。如果我将 list 文件中的启动模式更改为任何其他模式,它就可以正常工作。
你能解释一下为什么这个回调不起作用吗?
最佳答案
我认为问题在于 singleInstance 不允许被调用者 Activity 与调用者存在于同一任务中,因此它无法将值返回给调用者。
考虑使用 singleTask 代替:
单任务
The system creates the activity at the root of a new task and routes the intent to it. However, if an instance of the activity already exists, the system routes the intent to existing instance through a call to its onNewIntent() method, rather than creating a new one.
singleInstance
Same as "singleTask", except that the system doesn't launch any other activities into the task holding the instance. The activity is always the single and only member of its task.
http://developer.android.com/guide/topics/manifest/activity-element.html
关于android - 如果 Activity 的启动模式为 singleInstance,则不会触发 onActivityResult,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5118525/