简体   繁体   中英

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?

I have looked into the following links:

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.

Please perform following steps.

1)Delete your application and reinstall it.

2) After installing the application, it will display two option "Done" & "Open" click on Done button.

3) Now open the application from the application menu. Your problem will be solved.

When ever the HOME button is pressed, the application will start from the state where it left.

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. You can as well control your back button using onKeyDown and control the presence on your activities explicitly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM