Detailed explanation of Android activity lifecycle and stack management

Activity lifecycle

Activity is one of the four major components in Android. It is also the most basic and important component. It is a visual component provided by Android system that can be exchanged with users. The components provided by the system do not need to be instantiated by the user, and the user cannot instantiate them. The system calls back. For example, the servlet developed by the web is also provided by the system, just like other system components of Android.

How can we use these components without instantiation? These components have the same characteristics:

What are the methods of activity life cycle:

Activity has a total of the above 7 callback methods

Activiy has three small life cycles in total

Scene 1

Start to destroy an activity

This is a complete life cycle

Scene 2

A activity jumps to B activity (bactivity completely overwrites aaactivity)

The callbacks that B activity returns to a activity lifecycle are:

Scene 3

A activity jumps to B activity (B activity is an activity in the form of a dialog box or bactivity is transparent)

The callbacks that B activity returns to a activity lifecycle are:

Scenario 4

Horizontal and vertical screen switching of mobile phone, re implementation of Android life cycle method,

If you want to switch between horizontal and vertical screens without going through the life cycle again, you need to configure the property of activity in the list: configchanges. You can also set the screen lock to horizontal or vertical screen, screenorientation: lanscape | portal

2. Four states of activity

3. Three life cycles of activity

Stack management mode of activity

Startup mode

If you have any questions, please leave a message or go to the community to discuss common progress. Thank you for reading. I hope it can help you. Thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>