Create your own activity
1. New class, Inherit activity class
2. Overriding the OnCreate method of a new class
Public class extends Activity { publicvoid onCreate (Bundle saveinstancestate) { super . OnCreate (saveinstancestate); Setcontentview (r.layout.second_layout); // To reference the layout file, first build the file, see below
}
3. Create a new layout file
4. Add a description in Androidmainfest.xml (must be in application)
The Intent-filter in the first activity description is the description statement as the first start page
<ActivityAndroid:name=". Firstactivity "Android:label= "Activity created by yourself"> <Intent-filter> <ActionAndroid:name= "Android.intent.action.MAIN" /> <categoryAndroid:name= "Android.intent.category.LAUNCHER" /> </Intent-filter> </Activity> <ActivityAndroid:name=". Secondactivity "Android:label= "This is a second activity"/>
Create complete, detect references successfully by CTRL + Mouse
Create your own activity