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!
In this chapter, we continue to talk about the Activity life cycle. The Activity lifecycle looks like a whole, but it can be broken down into three small parts:
-
Complete life cycleCopy the code
-
Visible life cycleCopy the code
-
Foreground life cycleCopy the code
This classification method is officially recognized, you can find it on the official website. Let’s take a look at each of them.
1. Complete life cycle
Starting with the Activity’s initialization state, it goes through the start, run, pause, and stop states until the Activity is destroyed. This includes, of course, the three “twisted arrows” we mentioned in the previous chapter. The callback methods are executed alternately as the state of the Activity changes. We covered each state and the callback methods that match that state in the previous chapter, so if you have forgotten, you can review one of the previous chapters.
2. Visible life cycle
It starts with the Activity’s start state, goes through run and pause states, and ends with the Activist stop state, which, of course, includes two “crimping arrows.” The Activity can be seen throughout its life cycle, so it is named visible Life Cycle, which is a very graphic name.
3. Front desk life cycle
The Activity starts in the running state and ends in the paused state, including, of course, a “twisted arrow”. Throughout its life cycle, the Activity continues to gain focus, and it responds when we act on it. For this reason, we call this life cycle the foreground life cycle.
Guys, here’s a graph THAT I summarized a long time ago. It’s a little old (around 1.6), but it’s still correct, and it gives you a more intuitive view of all three life cycles.
This is an example of an Activity in Android. If you want to know more about it, listen to the next time.