简体   繁体   中英

Issue : New instance of activity created on resuming the app from background

Whenever I put my application in background, navigate through some other apps and resume my app, a new instance of the last opened activity is getting created.

The onCreate() method is invoked again and the state of the activity where I paused my app is lost. Also after logout/exit from the app the duplicate instance of the activity remains on top. I am not using any flags while starting the activity. The default launch mode is used.

I have tried using FLAG_ACTIVITY_SINGLE_TOP while starting the activity, but didn't work.

Can someone please suggest a way out?

Thanks in advance.

check that if you use some flags for intent to start activity and also

check that if you handle onPause() because whenever you press home button or out of the activity pause is called

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