Android 应用程序启动器的奇怪行为
大家好,我在启动应用程序时发现 Android 中的奇怪行为。让我解释一下高级。我从 android 的启动器页面启动我的应用程序,我的应用程序启动并运行良好,几分钟后我按主页按钮并转到 android 主页,然后转到启动器页面并再次选择我的应用程序,它从头开始再次启动,但是它应该从我上次离开的地方恢复。当我按下应用程序第二个实例的启动屏幕上的后退按钮时,我可以返回到我离开的最后一页。我对发生的事情感到更加困惑,这种情况有时也会发生,但不是每次都会发生。希望大家能帮我解决这个问题,希望得到更好的答复。提前致谢。
编辑#1: 并非所有设备都会出现这种情况,只有三星和索尼才会出现这种情况,但 LG 和 HTC 则运行良好。
hi guys i am finding the strange behaviour in android while launching the Application. Let me explain the senerio. I am launching my application from android's launcher page and my application starts and runs fine and after few minute i press home button and go to android home page and then go to launcher page and again select my application and it is starting it again from first but it should have resumed from the last place where i left. And when i press back button on the launch screen of second instance of my app i am able to go back to the last page where i have left. I am more confused about what was happening and it too happens sometimes only not every time. Hope you people could help me sort this problem, Hoping for better responses. Thanks in Advance.
Edit #1:
It is not happening in all the device it happens only with Samsung and Sony but works fine with LG and HTC.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
让一个活动在后台运行并不在你的掌控之中。当您按下主页按钮时,您当前的活动将转到后台,并且可以随时终止(将调用 onDestroy()),具体取决于您启动的其他应用程序的内存需求。
您启动的应用程序越多,杀死后台应用程序的机会就越大。
To keep an activity running in the background is not in your hand. When you press the home button, your current activity goes to the background and can be killed (onDestroy() will be called) at any time depending on the need for memory of the other applications you launch.
The more apps you launch, the more chances of killing your background app is.
该行为可能是特定于设备的 - 尝试将游戏设置保存在“onPause()”函数内的持久位置,并在“onResume()”上检索它。那么启动新活动或调用旧活动都无关紧要。
The behavior may be device specific - try saving your game settings in a persisted location within the 'onPause()' function, and retrieving it on 'onResume()'. Then it doesn't matter if a new activity gets launched or the old one gets called.