Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: singleInstance and startActivityForResult

AFAIK, startActivityForResult was not working properly with launchMode singleInstance here. While recently, I find it works well on Android Lollipop(5.0) and can't find official document describing it. I think it's also related to tasks and back stack at the same time. Is there anyone can provide some information or explanation about it or anything about it?

Thanks:)

like image 798
Jerome Avatar asked Oct 20 '22 18:10

Jerome


1 Answers

https://stackoverflow.com/questions/8960072/onactivityresult-with-launchmode-singletask

this is a brief explain。

The answer shows in function startActivityUncheckedLocked of class ActivityStackSupervisor. Before Android 5.x, when starting an activity, it will check launchMode first and add FLAG_ACTIVITY_NEW_TASK to launchFlags if launchMode is singleTask or singleInstance. If the activity's launchFlags contains FLAG_ACTIVITY_NEW_TASK, it will send back a cancel immediately and let the new task continue launched as normal without a dependency on its originator.

like image 98
Honest Avatar answered Oct 22 '22 07:10

Honest