如何在某一点驳回的Andr​​oid previous活动? [英] How to dismiss previous activities in android at a certain point?

查看:96
本文介绍了如何在某一点驳回的Andr​​oid previous活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有活动A - > B - > C,其中A和B是用于登录和验证的目的。当用户到达活动C,A和B是没有必要了。这意味着,如果用户preSS BACK在C,应用不应该去直通A和B,而是应该回到主屏。

I have activities A -> B -> C where A and B are for login and verification purpose. When a user reaches activity C, A and B are not necessary any more. That means if a user press BACK in C, the application should not go thru A and B, instead it should go back to HOME screen.

什么是android系统中实现这个常规的方法是什么?谢谢你。

What's the conventional way to implement this in android? Thanks.

编辑:澄清一点,用户应该能够登录/验证阶段时回到A从B,而不是从C到A或B,一旦用户到达ç

to clarify a bit, user should be able to go back to A from B during login/verification phase, but not from C to A or B once the user reaches C.

推荐答案

在去下一个活动通话

finish();

从明年开始活动之前。

before starting next activity.

或者,如果没有pressing回来,但要下一个活动:

Or, if not pressing back but going to next activity:

Intent intent = new Intent(this, A.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

这篇关于如何在某一点驳回的Andr​​oid previous活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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