android-activity startup Process
An Activity
Official definition: Activity is an important component of the interactive interface that Android applications provide
Add: Activity is a business class that is the foundation of the interface memory business behavior that hosts the application, including Ui,service, etc.
Two activation process of activity
1 Create a new activity class inheriting from the system activity class and defining attributes and internal methods
2 Register the Activity class within the manifest file:
<activity android:name= ". Activity1 ">
<intent-filter>
<action android:name= "Android.intent.action.MAIN"/>
<category android:name= "Android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
The above code is the activity class for the system to start by default, note name= ". Activity1 "before adding.
And the class name is the same as the activity name created, and the system cannot start if an error occurs
An application can have only one activity class that is started by default, which adds <action> and <category> two rows of activity
3 overriding the Parent class function oncreate () implementation
4 the definition of the interface->layout the XML file related to this activity class in its own definition:
Layout file naming all lowercase
5 interface bindings, Setcontentview (R.layout.***.xml) in the new Activity class
Kernel mechanism of three startactivity
StartActivity ()
Startactivityforresult (Intent,-1)
Execstartactivity (...) -
Activitymanagernative.getdefault (). StartActivity (...)
Note that Getdefault () implements the Iactivitymanager interface, which uses the system's services to start the Activitymanager interface.
Android-activity startup process