如何从堆栈中删除特定活动? [英] How to remove particular activities from stack?

查看:81
本文介绍了如何从堆栈中删除特定活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

比方说,我参加了这一系列活动:

Let's say that I have this stack of activities:

A -> B -> C -> D

活动D具有一个Save按钮.单击该按钮后,我想找回堆栈中的两个活动(CD是某种向导的一部分,所以我想将它们都删除):

The activity D has a Save button. After click on that button I want to get back two activities in the stack (C and D are part of some kind of wizard so I want to remove them both):

A -> B

这可能吗?

推荐答案

使用FLAG_ACTIVITY_CLEAR_TOP标志从D启动活动B.

Launch the activity B from D with FLAG_ACTIVITY_CLEAR_TOP flag..

Intent a = new Intent(this, B.class);
a.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(a);

这篇关于如何从堆栈中删除特定活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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