Activity life cycle in two different situations
(1) Life cycle in typical situations
Refers to changes in the life cycle of the activity as a result of the user's participation.
(2) life cycle in exceptional situations
The activity is destroyed and rebuilt by the system, or because the configuration of the current device is heavily changed.
See the activity life Cycle diagram for official documents
Note the following points:
(1) OnStart () and Onresume () from the actual use of the process is similar, but OnStart () when the activity is visible but still in the background, Onresume () when the activity has been shown in the foreground.
(2) OnStop () and OnPause () The difference is onpause () when the activity is also displayed in the foreground, OnStop () when the activity in the background is not visible.
(3) When a new activity is started, the old activity's OnPause () is executed first, and then the new activity is started, so do not do the heavyweight operation in the OnPause () method, as far as possible in the OnStop () process
Consider the activity with the project development:
(1)
The life cycle of the activity of the Reading notes of "Android Development Art exploration"