Classification of Intent (purpose)
One of the constructor overloads:
Intent Intent = new Intent (firstactivity.this,secondactivity.class); Creates a intent object, the first parameter, content (incoming context), and the second parameter passes into the target activity. startactivity (intent); Starting an activity with the StartActivity method, passing in parameters (intent)
The action and category descriptions are described in androidmainfest to initiate the activity only if the action and category in intent match category defaults to default (default ))
<ActivityAndroid:name=". Secondactivity "Android:label= "This is the activity to start"> <Intent-filter> <ActionAndroid:name= "Com.example.cenzhongman.ACTION_START"/> <categoryAndroid:name= "Android.intent.category.DEFAULT"/> </Intent-filter> </Activity>
Constructor overload two:
Public void OnClick (view view) { Toast.maketext (firstactivity. This, "Start Page two", Toast.length_short). Show (); New Intent ("Com.example.cenzhongman.ACTION_START"); // A string that passes directly to the action // default category default Match startactivity (intent); }
Second, self-destruct an activity
Killing a person only requires a word, and the destruction activity is the same:
Finish ();
Start a new page