简体   繁体   English

按HOME按钮后,应用程序启动应用程序主要活动的新实例

[英]After pressing HOME button, application starts a new instance of the application's main activity

I have MyApp ready, Now I see this bug, When I install the app it displays the splash screen, and moves to second activity and so on.Now when I click on HOME button and again start the app it starts from beginning and not from where I had left and this happens only when I install the app from Eclipse, and I notice that after the app restarts from beginning when I click back I can see that activity where I had left earlier? 我已准备好MyApp,现在我看到了这个错误,当我安装应用程序时它显示启动画面,然后移动到第二个活动等等。现在当我点击HOME按钮并再次启动应用程序时,它从头开始而不是从我离开的地方,只有当我从Eclipse安装应用程序时才会发生这种情况,我注意到应用程序从开始重新启动后,当我点击回来时,我可以看到我之前离开的活动?

I have looked into the following links: 我查看了以下链接:

https://code.google.com/p/android/issues/detail?id=14262 https://code.google.com/p/android/issues/detail?id=14262

How to prevent multiple instances of an activity when it is launched with different intents 如何使用不同的意图启动活动时,如何防止活动的多个实例

I think this is a bug in Android. 我认为这是Android中的一个错误。

Please perform following steps. 请执行以下步骤。

1)Delete your application and reinstall it. 1)删除您的应用程序并重新安装。

2) After installing the application, it will display two option "Done" & "Open" click on Done button. 2)安装完应用程序后,将显示两个选项“完成”和“打开”,单击完成按钮。

3) Now open the application from the application menu. 3)现在从应用程序菜单打开应用程序。 Your problem will be solved. 你的问题将得到解决。

When ever the HOME button is pressed, the application will start from the state where it left. 当按下HOME按钮时,应用程序将从它离开的状态开始。

If you are relaunching the same activity multiple times, please make use of intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) or other Intent flags as applicable and also finish() your activities if they are not required in the activity chain. 如果您多次重新启动相同的活动,请使用intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)或其他适用的Intent标志,如果活动链中不需要,还要finish()您的活动。 You can as well control your back button using onKeyDown and control the presence on your activities explicitly. 您还可以使用onKeyDown控制后退按钮,并明确控制活动的状态。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 按下主屏幕按钮后,新的应用程序实例将启动。 如何避免创建多个应用程序实例 - After pressing home button new Instance of application starts . How to avoid to create multiple instance of Application 应用程序在按android中的“主页”按钮后被杀死时无法打开主要活动 - Application not open main activity when it is killed after pressing home button in android 在Android中按下主页按钮后应用程序被杀死时不会打开主要活动 - Application not open main activity when it was killed after pressing home button in android 如果通过按“主页”按钮最小化了我的应用程序,我的通知服务将启动“主要活动” - My notification service starts Main activity if my app has been minimised by pressing the home button 按下主页按钮后如何返回到应用程序 - how come back to Application after pressing home button 按home键后保存Activity的状态 - After pressing home button saving the state of Activity 按下主页按钮并返回活动后无声音 - No sound after pressing home button and returning to activity 即使按下主页按钮,活动仍然可见 - Activity visible even after pressing home button Android:从主屏幕小部件启动应用程序活动的新实例 - Android: Launch new instance of application activity from home screen widget Android清单文件:用户在按下主屏幕按钮后恢复应用程序时,始终从Bean中启动应用程序 - Android manifest file: always start application from the beaning when user resuming the application after pressing the home button
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM