Problem with activity killed by system if no longer visible on Android

I have activity (A, B, C) in my application. When I launch the Activity A application:

  A:onCreate()
  A:onStart()
  A:onResume()

Using intention, I invoke the Second action (A β†’ B):

  A:onPause()
  B:onCreate()
  B:onStart()
  B:onResume()
  A:onStop()

Then I click the "Home" button. So, the application goes to the background: Now

  B:onPause()
  B:onStop()

After 1 or 2 hours. Again, I go to the home page on my device and click on the application icon, like:

 B:onDestroy()
 A:onRestart()
 A:onStart()
 A:onResume()

But I need to get to the point that from one action I quit like this,

B:onRestart()
B:onStart()
B:onResume()

I read several articles that he says how this activity, killed by the system due to the fact that it is no longer visible. Is there any way to fix my problem ...

Thanks in advance...

+5
source share
2

:

  • Android , . , , , . , , Android . , , , Android , ( , ). , ( : ).

  • Android , ( , - 30 ), , , , , , . , ( , ), Android , , , . ( ).

, Android β„–2. ,

    android:alwaysRetainTaskState="true"

<activity> root ( : , , ACTION_MAIN CATEGORY_LAUNCHER).

+6

, , , , . , , , .

+1

All Articles