I. Four states of activity
Running (Running): indicates activity is active, the user can click on the screen to respond, is also at the top of the activity stack state.
Paused (pause): indicates that the activity loses focus or is occupied by a non-full-screen activity (a transparent activity is at the top of the stack) and may be recycled when memory is tight.
Stopped (stop): When the activity is completely overwritten, the memory tension is still recycled.
killed (killed): indicates that the activity has been reclaimed by the system and that the saved information and member variables are not present.
Ii. Activity life Cycle analysis
1. The activity is first opened to perform the following life cycle methods: OnCreate ()->onstart ()->onresume ()
onCreate (): The first invocation of the life cycle method, you can do data loading, picture preloading operation.
OnStart (): indicates that activity is being started, is in a user-visible state, but is not displayed in the foreground and the user cannot interact with the activity, click, swipe (already seen, but cannot touch the state)
Onresume (): indicates that activity has been visible at the foreground and can interact with the user, touch, swipe, and so on.
2. Click the Home button to return to the main interface (activity is not visible) how to perform: OnPause ()->onstop ()
onPause (): indicates that activity is in a stopped state (visible, but cannot be touched).
onStop ():the OnPause () method finishes the call, indicating that activity has stopped and is completely obscured (memory is tight and may be recycled).
3. When returning to the original activity, the following methods are performed: Onrestart ()->onstart ()->onresume ()
Onrestart (): indicates that a restart is being made visible by an invisible change.
OnStart (): indicates that activity is being started, is in a user-visible state, but is not displayed in the foreground and the user cannot interact with the activity, click, swipe (already seen, but cannot touch the state) .
Onresume (): indicates that activity has been visible at the foreground and can interact with the user, touch, swipe, and so on .
4. When exiting the current activity, perform the following life cycle methods: OnPause ()->onstop ()->ondestroy ()
onPause (): indicates that activity is in a stopped state (visible, but cannot be touched).
onStop ():the OnPause () method finishes the call, indicating that activity has stopped and is completely obscured (memory is tight and may be recycled).
OnDestroy (): Activity life cycle The last method, you can do some resource recovery release work
"Android-1" Activity life cycle