First, interface jump
1. Define a new activity step:
1) Define a layout view (activity2_main.xml file),
2) Define a subclass that inherits activity (in the Mainactivity2.java file)
3) in the MainActivity2 class, override the life cycle method OnCreate () call Setcontextview () to bind the view (XML, hard-coded) to the activity sub-class
setContentView(R.layout.activity2_main);
4) Register the activity subclass with the Androidmanifest.xml manifest file (two methods):
Show Call
<activity android:name="com.example.dave.myapplication.MainActivity2" android:label="@string/app_name"> </activity>
implicit invocation
<activityandroid:name="Com.example.dave.myapplication.MainActivity2" Android:label="@string/app_name"> <intent-filter> <action android:name="Star_login" /> <category android:name="Android.intent.category.DEFAULT" /> </intent-filter> </activity>
5) Define a intent object within Mainactivity and invoke the Startacitivity () method of the current activity to start the new acitivity.
Display definition:
//MainActivity2为跳转的组件 new Intent(MainActivity.this, MainActivity2.class); startActivity(intent);
Implicit definition:
new Intent("star_login"); startActivity(intent);
Android Learning "Activity interface Jump"