The activity starts with the ActivityThread. main method, which calls prepareMainLooper and loop to initialize and start a Looper, respectively. All subsequent operations will be distributed through handler; In the handmessage callback method we find what is? Case statement, calling the handlelaunch method.

The PerformLaunch and Handleresume methods are called inside the Handlelaunch method.

First look at PerformLaunch, 1. Instantiate an activity object, 2. Then call its attach method, which creates a Phonewindow that helps the activity manage the view, 3. The OnCreate method of the activity is called, the setContView method is called from the OnCreate method of the activity, and the phoneWindow setContentView method is called. In this method, the decorView is first created. Is the top-level view from which all views inherit, and then parses the XML layout file passed in and adds the parsed view to the decorView, forming a preliminary tree view.

The handlresume method is called onResume first, and the user cannot see the interface. Then call the Windows Manager addView method, and finally call the Windows Manager Global AddView method, which creates a Viewrootimpl, which is responsible for the view drawing process, The setView method of Viewrootimpl is called, requestLayout is called to start drawing the view, and Viewrootimpl is the parent of the decorView.

Then call the Viewrootimpl’s PerFormTravel method, which calls perFormMeasure, PerFormLayout, and perFormDraw in sequence.