Android的突然离开活动堆栈 [英] Android Popping off the Activity Stack

查看:106
本文介绍了Android的突然离开活动堆栈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的应用程序,我们有活动A,B,C,D和E的用户通常会从A到E,通过对B移动,C,D。

In our app, we have Activities A,B,C,D, and E. The user usually goes from A to E, moving through B,C,D.

在活动Ë我们要回到A,并从堆栈中去掉B,C,D的。我们不希望给E重新创建。

In Activity E we want to go back to A, and get rid of B,C,D from the stack. We don't want to recreate A from E.

我如何'流行过'B,C,D从堆栈,然后返回到A?

How do I 'pop off' B,C,D from the stack and then return to A?

推荐答案

如果一个已经在运行,你可以使用<一个href="http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_TOP">FLAG_ACTIVITY_CLEAR_TOP标志开始的意图回到A的时候。

If A is already running, you can use the FLAG_ACTIVITY_CLEAR_TOP flag when starting an intent to go back to A.

另见,类似的问题:

<一个href="http://stackoverflow.com/questions/3338841/how-to-clear-current-activities-in-the-stack">http://stackoverflow.com/questions/3338841/how-to-clear-current-activities-in-the-stack

<一个href="http://stackoverflow.com/questions/3408388/how-to-kill-sub-activities-and-bring-activity-to-top-of-stack">http://stackoverflow.com/questions/3408388/how-to-kill-sub-activities-and-bring-activity-to-top-of-stack

这篇关于Android的突然离开活动堆栈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆