结算活动堆栈不工作 [英] Clearing activity stack is not working

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

问题描述

我有以下设置为我的活动:

I have the following setup for my activities:

A(noHistory) - > B - >Ç - >ð - >电子

所以,当我开始动鄂活动ð我想电子成为根系活力和清除后退堆栈的其余部分。

So when I start activity E from activity D I want E to become the root activity and clear the rest of the back stack.

我跟这里很多帖子中提到的解决方案,这是对下列标志添加到我的意图:

I followed the solution mentioned in many posts here which is to add the following flags to my Intent:

final Intent explicitIntent = new Intent(this,
                E.class);
        explicitIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
        explicitIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        this.startActivity(explicitIntent);

然而,动鄂(这是没有运行之前)不会成为回堆栈的根。相反,只是活动ð从后面堆栈中删除, C B 仍然存在,如果我preSS后退按钮。

However, Activity E (which was not running before) does not become the root of the back stack. Instead, just Activity D is deleted from the back stack, C and B are still there if I press the back button.

那么,我要实现的SDK&LT真的不可能什么; 11如下所述:<一href=\"http://stackoverflow.com/questions/3473168/clear-the-entire-history-stack-and-start-a-new-activity-on-android\">Clear整个历史堆栈,并在Android 开始新的活动?

So is what I want to achieve really impossible in SDK < 11 as described here: Clear the entire history stack and start a new activity on Android ?

推荐答案

在结束我只是做了作为RASEL建议(在评论我的问题)
当进入活动专口呼吁活动乙完成,C,D,让他们堆栈。

In the end I just did as Rasel advised (in the comments to my question) When entering activity E i called finish on activities B,C,D to get them off the stack.

这篇关于结算活动堆栈不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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