Hello, everyone. Last time we talked about the Activity example in Android. This time we will continue with that example. Stop gossiping and return to the truth. Let’s Talk Android!
After introducing the state of an Activity, we will focus on analyzing the arrows in the graph of the Activity lifecycle, that is, making the graph move with the arrows.
We follow the Activity lifecycle from start to finish. First of all, there is no Activity. After executing the onCreate method, it initializes the Activity, and then the arrow flows from onCreate to onStart. At this point, the Activity completes its initialization process and is about to appear as a screen. After the onStrat method completes, we can see what the Activity really looks like.
The arrow flows from the onStart method to the onResume method, and the Activity is not only visible but also responds to user actions, such as swiping or clicking on controls.
After the onResume method completes, the arrow flows to the onPause method. The Activity is still visible, but it does not respond to the user’s actions. The Activity is said to be sleeping, and it cannot hear its name.
The arrow then goes to the onStop method, at which point the Activity goes into the background and we can no longer see it, so we call it “underwater,” or “invisible,” as is appropriate, because it has disappeared from view.
The Activity is gone, but it is still holding resources in the system. The arrow goes to the onDestroy method, which frees the resource used by the Activity. This frees the system resource from the invisible Activity and makes it available to other activities later.
At this time, a warden asked, there are several other arrows have not been introduced, don’t worry, we will introduce you next time. Please rest assured.
This is an example of an Activity in Android. If you want to know more about it, listen to the next time.