当启动模式= "singleTask"时重新打开活动时,后退堆栈会发生什么情况?



想象一个应用程序,其中活动A是默认的活动,并且具有launchMode="singleTask"。应用程序打开到活动A。用户在应用程序中导航,并在某个时刻再次导航到活动A(通过向前移动,而不是向后按)。根据Android文档,因为launchMode="singleTask",所以会发生这种情况:

系统在新任务的根位置创建活动并路由意图。但是,如果活动的实例已经存在,系统通过调用其onNewIntent()方法,而不是创建一个新方法。

活动A存在于后堆栈上,因此它将接收对onNewIntent()的调用。我想知道的是,当活动A从后堆栈的底部移到顶部时,其他活动会发生什么

它们是被弹出并销毁还是发生了其他事情?它们甚至在同一个堆栈中吗?

提前感谢。。。

从Android文档:http://developer.android.com/images/fundamentals/diagram_backstack_singletask_multiactivity.png

A representation of how an activity with launch mode "singleTask" is added to the back stack. If the activity is already a part of a background task with its own back stack, then the entire back stack also comes forward, on top of the current task.

相关内容

最新更新