点击主页按钮后返回第二项活动 [英] Return to second activity after clicking home button

查看:117
本文介绍了点击主页按钮后返回第二项活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了所有launchMode的但它似乎不工作:

I've tried all launchMode's yet it does not seem to work:

假设应用程序A有各种各样的活动,J和K. J是最初的一(选择应用程序模式),它调用K其中主要的事情发生(调用它,J完成()上课后)。如果我点击主页按钮,在K,然后再次打开该应用程序,它会打开一个新的实例与活动学家

Suppose App A has various activities, J & K. J is the initial one (to choose app mode), which calls K where the main things happen (after calling it, J finish()es). If i click "Home" button in K, and then open the app again, it opens a new instance of A with activity J.

我想它打开暂停-K活性代替。其他线程提到一个Android的错误 - 是有办法解决这个问题?设置launchMode不工作:•

I'd like it to open the paused K activity instead. Other threads mention an Android bug -- is there a way to fix it? Setting launchMode does not work :S

多谢了。

推荐答案

你想要的是Android的正常行为。它没有工作意味着你可能在做一些奇怪的事实。不要试图用launchModes玩弄解决这个问题。请发表您的清单中的相关部分。然而,还有就是,它体现这样的错误。要查看此错误是造成您的问题请执行以下操作:强行关闭手机上的应用程序。现在从手机上的应用程序列表中启动应用程序。从加ActivityJ到ActivityK。 preSS HOME。再次打开该应用程序。如果一切正常,现在,你只是看到了可怕的Andr​​oid推出的bug。

What you want is normal Android behaviour. The fact that it isn't working means that you are probably doing something strange. Do not try to solve this by playing around with launchModes. Please post the relevant parts of your manifest. There is, however, a bug which manifests itself like this. To see if this bug is causing your problem do the following: force-close your app on the phone. Now start your app from the list of apps on the phone. Go from ActivityJ to ActivityK. Press HOME. Open the app again. If it works now, you are just seeing the dreaded Android launch bug.

有关推出错误的详细信息,请参阅这些问题:

For more details on the launch bug, see these issues:

HTTP://$c$c.google。 COM / P /安卓/问题/详细信息?ID = 2373

HTTP://$c$c.google。 COM / P /安卓/问题/详细信息?ID = 26658

该错误是在所有设备上存在,在所有版本的Andr​​oid(至少到ICS,未在软糖测试过)。它所有的工作,因为它应该在模拟器中,所以你不能使用仿真器的行为真实设备行为的指示。

The bug is there on all devices, on all versions of Android (at least up to ICS, haven't tested on JellyBean yet). It all works as it should in the emulator, so you cannot use emulator behaviour as an indication of real device behaviour.

这篇关于点击主页按钮后返回第二项活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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