想象一下,你有以下一系列活动:
Imagine you have the following sequence of activities:
Activity A -> Activity B -> Activity C当你在活动C,pressing本机返回按钮,带您到活动B.现在有什么活动C的状态呢?它仍然在内存中,或已经完成了吗?
When you are on Activity C, pressing the native back button, takes you to Activity B. Now what is the state of Activity C? Is it still in memory or it has been finished?
如果它仍然在内存中,有没有办法恢复的活动?除了在开始本次活动的另一个实例...
If it is still in the memory, is there a way to resume the activity? Other than starting another instance of this activity...
我要补充一点,这就是你不使用任何标志,包括标准的情况下: FLAG_ACTIVITY_CLEAR_TOP
I should add that this is the standard case where you do not use any flags including: FLAG_ACTIVITY_CLEAR_TOP
推荐答案您可能要考虑阅读的官方文档。
更具体的回答你的问题的一部分:
More specifically the part that answers your question:
当用户presses后退按钮,当前的活动是从堆栈的顶部(活性被破坏)和previous活动恢复弹出(其UI的previous状态恢复)。
When the user presses the Back button, the current activity is popped from the top of the stack (the activity is destroyed) and the previous activity resumes (the previous state of its UI is restored).
现在你的第二个问题......你可以继续阅读同一页面...
Now for your second question… you can keep reading the same page…
当你开始一个活动,你要提出它的一个现有实例(而不是在后面堆栈的顶部创建一个新的实例)
when you start an activity, you want to bring forward an existing instance of it (instead of creating a new instance on top of the back stack)
所以,如果你看的......你会发现...
So if you read that… you will find…
您可以做这些事情多了,在属性 清单元素并与意图传递给标志 startActivity()。
You can do these things and more, with attributes in the manifest element and with flags in the intent that you pass to startActivity().
在这方面,主要属性可以使用是:
In this regard, the principal attributes you can use are:
taskAffinity launchMode allowTaskReparenting clearTaskOnLaunch alwaysRetainTaskState finishOnTaskLaunch
taskAffinity launchMode allowTaskReparenting clearTaskOnLaunch alwaysRetainTaskState finishOnTaskLaunch
和可以使用的主要意图标志是:
And the principal intent flags you can use are:
FLAG_ACTIVITY_NEW_TASK FLAG_ACTIVITY_CLEAR_TOP FLAG_ACTIVITY_SINGLE_TOP
FLAG_ACTIVITY_NEW_TASK FLAG_ACTIVITY_CLEAR_TOP FLAG_ACTIVITY_SINGLE_TOP
更多推荐
ANDROID:$ P $后活动状态pssing后退按钮
发布评论