如何把一个活动的前景(堆栈的顶部)? [英] How to bring an activity to foreground (top of stack)?
问题描述
在Android的,我定义的活动为ExampleActivity。
In Android, I defined an activity ExampleActivity.
在我的应用程序的启动,创建此A-活动的一个实例,说这是 A
。
当用户点击在 A
按钮,对B-活动的另一个实例,B已创建。现在的任务堆栈B-A,用乙在顶部。然后,用户点击B,C-活动的另一个实例的一个按钮,和C已创建。现在的任务堆栈CBA,用C在顶部
When my application was launched, an instance of this A-Activity was created, say it is A
.
When user clicked a button in A
, another instance of B-Activity, B was created. Now the task stack is B-A, with B at the top. Then, user clicked a button on B, another instance of C-Activity, and C was created. Now the task stack is C-B-A, with C at the top.
现在,当用户点击℃的按钮,我希望应用程序带来的前景,也就是使一个是在任务堆栈的顶部,ACB。
Now, when user click a button on C, I want the application to bring A to the foreground, i.e. make A to be at the top of task stack, A-C-B.
我怎么能写code来做到这一点?
How can I write the code to make it happen?
推荐答案
您可以试试这个<一href="http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_REORDER_TO_FRONT"><$c$c>FLAG_ACTIVITY_REORDER_TO_FRONT$c$c> (该文件描述正是你想要)
You can try this FLAG_ACTIVITY_REORDER_TO_FRONT
(the document describes exactly what you want to)
这篇关于如何把一个活动的前景(堆栈的顶部)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!