Table of Contents
TODO:
- Processes and Threads
- How threads work for bound services.
Activity and App destruction
The system never kills an activity directly to free up memory. Instead, it kills the process in which the activity runs, destroying not only the activity but everything else running in the process, as well.
onDestroy
is called when your Activity is finished (either through calling finish
or the user hitting back) but not when the entire App is finished.
Therefore onDestroy
should be used for cleaning up your program state and freeing up memory - neither of which matter if the app is killed.
If a Task consists of Activities from multiple different Apps, an App who’s Activity is in the background may be killed. When the user navigates back to that Activity, the App is restarted.