Android jumps from one App interface to another App interface
First, expose the activity of the App that needs to be jumped
<activity
android:name=".MainPage"
android:exported="true">
</activity>
It should be noted that if it is not exposed, an error will be reported
Then write the following code at the place where the jump is required
to display Start
1 Common
Intent intent =new Intent(FirstActivity.this,SecondActivity.class);
startActivity(intent);
2 ComponentName via Intent:
//前提:知道要跳转应用的包名、类名
Intent intent =new Intent(Intent.ACTION_MAIN);
//ComponentName的第一处是package的包名,第二个是锁需要进行跳转的类名
ComponentName componentName = new
ComponentName("com.example.selftest","com.example.selftest.MainPage");
intent.setComponent(componentName);
startActivity(intent);
3 Specify the package name when initializing the Intent:
Intent intent = new Intent("android.intent.action.MAIN");
intent.setClassName("当前Act的全限定类名","启动Act的全限定类名");
startActivity(intent);
Implicit start
is realized through Action, Category or data of Intent-filter
Intent intent1 =new Intent("com.example.helloandroid.core.action.SecondActivity");
startActivity(intent1);