安卓:回到previous活动 [英] Android: Go back to previous activity

查看:148
本文介绍了安卓:回到previous活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做的事情在Android上的应用程序简单。 怎么可能回到一个previous活动。

I want to do something simple on android app. How is it possible to go back to a previous activity.

什么code,我需要回去previous活动

What code do I need to go back to previous activity

推荐答案

机器人活动被存储在活动栈。让我们回到一个previous活动可能意味着两件事情。

Android activities are stored in the activity stack. Going back to a previous activity could mean two things.

  1. 您是 startActivityForResult 打开从另一个活动的新活动。在这种情况下,你可以致电 finishActivity()功能从code,它会带你回到previous活动。

  1. You opened the new activity from another activity with startActivityForResult. In that case you can just call the finishActivity() function from your code and it'll take you back to the previous activity.

跟踪活动栈。每当你开始一个新的活动,意图可以指定一个意图标志像 FLAG_ACTIVITY_REORDER_TO_FRONT FLAG_ACTIVITY_ preVIOUS_IS_TOP 。你可以使用这个应用程序中的活动之间重新洗牌。不使用它们虽然很多。看一看这里的标志:<一href="http://developer.android.com/reference/android/content/Intent.html">http://developer.android.com/reference/android/content/Intent.html

Keep track of the activity stack. Whenever you start a new activity with an intent you can specify an intent flag like FLAG_ACTIVITY_REORDER_TO_FRONT or FLAG_ACTIVITY_PREVIOUS_IS_TOP. You can use this to shuffle between the activities in your application. Haven't used them much though. Have a look at the flags here: http://developer.android.com/reference/android/content/Intent.html

这篇关于安卓:回到previous活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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