Life and death is something that everyone has to go through. So don't panic, calm down and think about what you should do at each stage of your life in order to improve your life value, or increase your own value. In one life cycle, what is done at a certain stage, not completed, may affect the entire life cycle. So sometimes life can not degenerate, a fall may be a lot of good things will be missed, waiting for you only the Silent confession!
For the life cycle of the activity process, the most classic picture is as follows:
1. When an activity a starts, it goes through each of the following stages:
OnCreate ()-->onstart ()-->onresume ()
2. When another activity B is being opened,activity A can also be seen when the stage goes through:
OnPause ()
3. When another activity B is opened andactivity A is not visible , the stage goes through:
OnStop ()
4. When activity b is closed, go back to activity a and go through the stages:
Onrestart ()-->onstart ()-->onresume ()
5. When activity a closes, it goes through the stages:
OnDestroy ()
6. Or when activity A is in the OnPause and OnStop state, when the higher priority apps require memory, and the system memory is not enough, then the Android system kills the process where ctivity A resides to free up resources . So we're back in the 1 phase.
Toss an example to understand the following: