首页 文章

当launchMode =“singleTask”重新打开活动时,后台堆栈会发生什么?

提问于
浏览
4

想象一个应用程序,其中活动A是默认活动,并具有launchMode = "singleTask" . 该应用程序将打开活动A.用户浏览应用程序,并在某些时候再次导航到活动A(向前移动,而不是向后按) . 根据Android文档,因为launchMode = "singleTask",这将发生:

系统在新任务的根目录下创建活动,并将意图路由到该任务 . 但是,如果活动的实例已存在,系统会通过调用其onNewIntent()方法将意图路由到现有实例,而不是创建新实例 .

活动A存在于后台堆栈上,因此它将接收对onNewIntent()的调用 . 我想知道的是, what happens to the other Activities when Activity A is brought from the bottom of the back stack to the top?

它们是弹出和破坏还是发生了其他事情?他们甚至在同一堆栈中吗?

提前致谢...

1 回答

相关问题