为什么次要活动也将重返主力活动时,被破坏? [英] Why is secondary activity being destroyed when going back to main activity?
问题描述
在回去活性的(主要活动)活动B被破坏。为什么是这样?
When going back to activity A (main activity) the activity B is being destroyed. Why is that happening?
该示例程序我想了解的是在这里: http://developer.android.com/shareables/training/ActivityLifecycle.zip
The example program I'm trying to understand is here: http://developer.android.com/shareables/training/ActivityLifecycle.zip
推荐答案
这里有一个如何在任务中每一个新的活动增加了一个项目后面堆了重新presentation。当用户presses后退按钮,当前的活动被破坏,previous活动恢复。
Here's a representation of how each new activity in a task adds an item to the back stack. When the user presses the Back button, the current activity is destroyed and the previous activity resumes.
为什么要破坏?因为最新的活动是在堆栈的顶部,并获得到下一个活动,你弹出最新的关闭(的 LIFO )。更多信息此处 。
Why destroyed? Because the latest activity is on top of the stack and to get to the next activity, you pop the latest off (LIFO). More info here.
这篇关于为什么次要活动也将重返主力活动时,被破坏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!