0

I m facing this issue of creating multiple instance of same activity when app comes in foreground from background. Every time app goes in background then comes in foreground after sometime, new activity created without destroying old so the count increases by 1 every time.

while debugging with android studio, it is found that instance of application shows dead after remaining for sometime in background, after this dead state when app comes in background this issue happens.

Launch Mode is SingleTop with ClearTop

Logs in screenshots are stated as :
in activity oncreate ----> in oncreate function of activity
in oncreate ----> in oncreate function of fragment attached to activity
in onViewCreated ----> in onViewCreated function of fragment

For screenshots click on links below.

app open first tym and moved to background

Dead state is showing instead of app running in background, when it brought to foreground, new Activity created. and look at screenshot below

after bringing in foreground

  • It seems conflict for what you saying: "new activity created without destroying old", "application shows dead after remaining for sometime in background". However, the application comes to dead, Activity shall recreate when you revisit. Did you check whether Application.onCreate() invoked twice? – HunkD Aug 30 '20 at 03:11
  • please edit your question and add the content of your manifest. Also, have you added logging for calls to `onDestroy()`? – David Wasser Sep 04 '20 at 11:54

0 Answers0