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. (You will learn more about Android application processes in Chapter 23.)

Processes containing resumed or paused activities get higher priority than other processes. When the OS needs to free up resources, ...

Get Android Programming: The Big Nerd Ranch Guide, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.