还要进行两次活动吗? [英] Going Two Activities back?

查看:58
本文介绍了还要进行两次活动吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下活动序列: Avtivity01 => Avtivity02 => Avtivity03

I have this Activities sequence: Avtivity01 => Avtivity02 => Avtivity03

单击按钮后,您可以从Avtivity01转到Avtivity02.

You can go from Avtivity01 to Avtivity02 after you click a button.

单击按钮后,您可以从Avtivity02转到Avtivity03.

You can go from Avtivity02 to Avtivity03 after you click a button.

-

点击按钮后,我想从Activity03转到Activity01 直接.

I want to go from Activity03 to Activity01 DIRECTLY after I click a button.

-

注意:

我不想使用Intent,因为我想拥有Activity01 ,就像我按下Activity02

I do NOT want to use Intent, because I want to have Activity01 as if I pressed the back button from Activity02

请问该怎么做?

推荐答案

为什么不能使用Intent?单击按钮时,您可以使用 FLAG_ACTIVITY_CLEAR_TOP . 如果要保留Activity的原始实例,则可以将此标志与

Why can't you use an Intent? You can use the FLAG_ACTIVITY_CLEAR_TOP when you click the button. If you want to preserve the original instance of the Activity, you can use this flag in conjunction with FLAG_ACTIVITY_SINGLE_TOP.

您是否曾经希望能够按下Activity03中的按钮以返回到Activity02?如果您始终希望它返回到Activity01,则可以在清单中的Activity02上使用android:noHistory="true",而只需在Activity03上调用finish().

Do you ever want to be able to press a button from Activity03 to go back to Activity02? If you ALWAYS want it to go back to Activity01, you could alternatively use android:noHistory="true" on Activity02 in the manifest and just call finish() on Activity03.

这篇关于还要进行两次活动吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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