android - 如何从第三个 Activity 回到第一个 Activity ?

标签 android

我有三个 Activity A、B 和 C。现在任务我有这个表单 A、B 和 C,在默认的 android“标准”模式下 Activity 导航发生这样的 A->B->C->B ->A.现在我想要的是当我从 B 转到 Activity C 时,当我在 Activity 中 backPressed 我去了之前的 Activity 即 B 但是我想从 C 回到 A。谁能告诉我如何实现这个关于这个??

,我想通过 Intent 标志来做,或者如果可能的话想为 Activity 应用启动模式,但我很困惑我应该使用哪种启动模式来实现这一目标?-有人可以帮助我吗

提前致谢

最佳答案

只需启动一个新的 Intent 并清除堆栈中的 Activity 。

 Intent intent = new Intent(this, A.class);
 intent.addFlags(IntentCompat.FLAG_ACTIVITY_CLEAR_TASK);
 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
 startActivity(intent);

关于android - 如何从第三个 Activity 回到第一个 Activity ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11626876/

相关文章:

java - 没有异常仍然没有从 while 循环中出来

android - Firebase 使用预构建的 UI 登录 Facebook 登录不起作用;显示登录错误 : There is an error in logging you into this application

android - 如何覆盖 fragment 中的 float 操作按钮?

android - 两个带有 PendingIntents 的按钮 - Widget

android - Galaxy Note 上的动画不流畅

android - ViewPager 快速滑动给出了 IndexOutOfBoundsException

android - 将 WiiMote 连接到安卓设备

android - 如何在使用 Intent 发回数据时跳过一项 Activity ?

android - SearchView 上的边距太多

android - 通过 Intent 向多个电话号码发送短信