开发者

Activity is destroyed and then recreated before receive onActivityResult

My Activity has Handler object, and registers ContentObserver with this handler. Then I launch external activity, that may sometimes change content (I use content observer to catch this alters). Then activity returns result, and then I check my observer, if content was changed since I started that activity for result. Problem is that sometime, right before onActivityResult, my activity gets onDestroy - onCre开发者_开发技巧ate, and as result, everything I catched from observer is lost.

this Activity has following properties in AndroidManifest:

android:clearTaskOnLaunch="true"
android:launchMode="singleTop"

Did anybody face this problem? Why activity may be destroyed before get result? Is there safe place to put my observer and handler (if activity isnt safe)?


Try to change the launchmode. When I used external activities for results and setting the result the result code was always cancel when I used singleTop as a launch mode. Changing it to IE standard worked like a charm. Might be worth a try.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜