Android的活动管理 [英] Android Activity management

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

问题描述

我有一个问题在脑海中的活动管理。假设我有4个活动说,例如A1,A2,A3,A4。现在,A1有一个按钮,启动活动A2。 A2有2个按钮,其中启动或者A3或A4,A3有2个按钮,它们开始活动A4和A1。 A4有3个按钮SART活动A1,A2,A3,我不以任何本次活动使用的方法完成。所以现在用户点击任何一个活动的任何按钮,比检查活动,就是这种已经在回地面?如果是的话比这个活动将不会产生新的实例,然后启动活动是背景已。否则,创建新的坚持。

I have one question in mind for activity management. Suppose I have 4 activities say for example A1,A2,A3,A4. Now A1 have one button which start activity A2. A2 have 2 buttons which start either A3 or A4, A3 have 2 buttons which start activity A4 and A1. A4 have 3 buttons to sart activity A1,A2,A3 I do not use finish method in any of this activity. So now user click any of the activity any of the button than check the activity ,that is this already in back ground? If yes than this activity would not generate new instance and start activity which is already in background. otherwise it create new insistence.

推荐答案

您可以通过包括得到这种行为的<一个href="https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_REORDER_TO_FRONT"><$c$c>FLAG_ACTIVITY_REORDER_TO_FRONT意图的标志,然后就打电话 startActivity(意向)就像你通常会。

You can get this behaviour by including the FLAG_ACTIVITY_REORDER_TO_FRONT in your Intent's flags and then just calling startActivity(intent) like you normally would.

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

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