onActivityResult 与launchMode=“singleTask"? [英] onActivityResult With launchMode="singleTask"?
问题描述
当您尝试为具有 launchMode="singleTask"
的 Activity
设置 startActivityForResult
时;它不会返回带有 onActivityResult
的任何值,并且当您设置 launchMode="standard"
时;一切正常,但系统要求说这个 Activity
必须是 singleTask
,有没有办法解决这个问题?
When you try to startActivityForResult
for Activity
that has launchMode="singleTask"
; it will not return any values with onActivityResult
,and when you set launchMode="standard"
; everything works fine, but the system requirements says this Activity
must be singleTask
, is there anyway to solve this?
推荐答案
For example, if the activity you are launching uses the singleTask launch mode,
it will not run in your task and thus you will immediately receive a cancel result.
似乎没有办法解决这个问题.
It seems there is no way to get around this.
如果你是被调用Activity的开发者,那么你可以让它在有结果时发送广播.然后调用 Activity 可以列出此广播.
If you are the developer of called Activity, then you can have it send a broadcast when some result is available. The calling Activity can then list to this broadcasts.
这篇关于onActivityResult 与launchMode=“singleTask"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!