First, learn about the four states of activity
Running state: After a new activity has been launched into the stack, it is at the top of the screen at the topmost point of the stack, where it is visible and can interact with the user in the active state.
Paused state: State when activity is overwritten by another transparent or dialog-style activity . At this point it remains connected to the window manager, the system continues to maintain its internal state, it is still visible, but it has lost focus and therefore cannot interact with the user.
Stopped state: Activity is in stopped state when activity is not visible. When activity is in this state, be sure to save the current data and the current UI state, otherwise the current data and UI state will be lost once the activity exits or shuts down.
Killed status: The activity was killed or was started before it was in killed state. This is the activity that has been removed from the activity stack and needs to be restarted before it can be displayed and used.
In 4 states, the running state and the paused state are visible, stopped state and killed state are not visible.
The difference between OnStart () and Onresume ()
OnStart () is performed when the activity interface is displayed, and the user is visible, including an activity on top of him, but not completely covered, and the user can see part of the activity but cannot interact with it
Onresume () is executed when the activity interacts with the user, and the user can gain focus on the activity and be able to interact with the user.
OnStart () is usually onstop () (that is, the user presses the home key, the activity becomes the background), and then the user switches back to the activity to call Onrestart () and then OnStart ()
Onresume () is onpause (usually the current acitivty is paused, such as being overwritten by another transparent or dialog-style activity ), then dialog is canceled and the activity returns to the interactive state, Call Onresume ().
Extension: After testing, the OnPause () method will not be called when the dialog is ejected, but will be called when overridden by another transparent or dialog-style activity.
Reference: Pause (pause) and resume (re-return) of activity's life cycle
Activity life cycle
Differences between OnStart () and Onresume () in the Android Activity lifecycle