Android launchMode singleTask

Cri*_*sti 4 android android-manifest

如果我们有2个活动,A并且B,这两个定义为singleTaskAndroidManifest.xml的时候A开始B,A将被关闭(onDestroy()被立即调用).为什么会发生这种情况,以及如何避免A被系统关闭(singleTask同一应用程序中的多个活动)?

Juo*_*nis 5

来自文档:

"singleTask" and "singleInstance" activities can only begin a task. They are always at the root of the activity stack.

由于系统中不能有两个根活动,因此在启动此类任务时将关闭所有先前的活动.