Activity States and Lifecycle Callbacks

Every instance of Activity has a lifecycle. During this lifecycle, an activity transitions between four states: resumed, paused, stopped, and nonexistent. For each transition, there is an Activity function that notifies the activity of the change in its state. Figure 3.4 shows the activity lifecycle, states, and functions.

Figure 3.4  Activity state diagram

Activity state diagram

Figure 3.4 indicates for each state whether the activity has an instance in memory, is visible to the user, or is active in the foreground (accepting user input). Table 3.1 summarizes this information.

Table 3.1  Activity ...

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.