Note that there are some explanatory texts on larger screens.

plurals
  1. POdetails of Android application components destruction and recreation
    text
    copied!<p>Could someone push me in the direction of some concrete, trustworthy (and preferably concise) information on the following:</p> <ol> <li><p>The order in which components are destroyed and (where applicable)recreated by the system (Fragment, Activity, Activity's Threads/AsyncTasks/Timers, static data(when are classes unloaded?), Threads/AsyncTasks/Timers in other classes, host TabActivity, ActivityGroup, bound local Services, Application, process) both when the app is in the background, and in the foreground.<br> At which points the destruction can stop (what states can be encountered upon return to the app - like "everything including the Application object destroyed, process alive"?</p></li> <li><p>Is it possible (without modifying Android) to programmatically cause the same kind of destruction ourselves, so that it is indistinguishable from when the system does it, or is a separate mechanism needed for when we ourselves choose to free memory (triggered by onLowMemory)?</p></li> <li><p>Reliable reproduction steps of all scenarios from 1) (would junit.framework do? I haven't investigated that) ?</p></li> <li><p>"<a href="http://developer.android.com/guide/topics/fundamentals/tasks-and-back-stack.html#Clearing">If the user leaves a task for a long time, the system clears the task of all activities except the root activity. When the user returns to the task again, only the root activity is restored</a>": is this aside from the process/component lifecycle/destruction, or tied to it?</p></li> </ol> <p>I have read various sources give pieces of information, often incomplete and misleading, sometimes incorrect.<br> I admit, I have skimmed over some parts of the documentation, so i may have missed or misunderstood something.<br> <br> [EDIT] To avoid misunderstandings: What I am asking about is Android destroying components to free memory, <em>bypassing</em> Activity.onDestroy.<br> When I put the app in the background and return later, the one of these sequences will occur:</p> <ul> <li>onPause, onStop, onRestart, onStart, onResume<br></li> <li>onPause, onStop, Application.onCreate, onCreate(notNull), onStart, onResume</li> </ul> <p>[EDIT2] Bounty started. Need reliable info on: Activities, Fragments, Application, bound (potentially remote)Services, process.<br> Partial/full destruction scenarios. See 1st point.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload