Saving Data Across Process Death
Configuration changes are not the only time the OS can destroy an activity even though the user does not intend it to.
Each app gets its own process (more specifically, a Linux process) containing a single thread to execute UI-related work on and a piece of memory to store objects in. An app’s process can be destroyed by the OS if the user navigates away for a while and Android needs to reclaim memory. When an app’s process is destroyed, all the objects stored in that process’s memory are destroyed.
Processes containing resumed or started activities get higher priority than other processes. When the OS needs to free up resources, it will select lower-priority processes first. Practically speaking, ...
Get Android Programming: The Big Nerd Ranch Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.