Saut implicite : sauter à l'extérieur de l'application
Description : la page vers laquelle sauter n'est pas claire, mais la page cible est déterminée par le filtrage conditionnel
1. Ajoutez le paramètre setAction ("") à l'intent dans le fichier de code.
Il est également possible dans l'exemple de code java de setData("")
: Cliquez sur le bouton pour passer à Baidu/Caméra/Téléphone/SMS
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getBaseContext(), "去隐式内部页面", Toast.LENGTH_LONG).show();
Intent intent = new Intent();
//自定义的条件用来跳到自己写的页面内部的app页面跳转
intent.setAction("com.studay.base.study.jump.InnerJumpActivity");
startActivity(intent);
}
});
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getBaseContext(), "去百度", Toast.LENGTH_LONG).show();
Intent intent = new Intent();
//自定义的条件用来跳到自己写的页面内部的app页面跳转
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.baidu.com"));
startActivity(intent);
}
});
button3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getBaseContext(), "去相机", Toast.LENGTH_LONG).show();
Intent intent = new Intent();
//自定义的条件用来跳到自己写的页面内部的app页面跳转
intent.setAction("android.media.action.STILL_IMAGE_CAMERA");
startActivity(intent);
}
});
button4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getBaseContext(), "去电话", Toast.LENGTH_LONG).show();
Intent intent = new Intent();
//自定义的条件用来跳到自己写的页面内部的app页面跳转
intent.setAction(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:15239862553"));
startActivity(intent);
}
});
button5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getBaseContext(), "去短信", Toast.LENGTH_LONG).show();
Intent intent = new Intent();
//自定义的条件用来跳到自己写的页面内部的app页面跳转
intent.setAction(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("smsto:15239862553"));
intent.putExtra("smsbody","你好啊,这是给小新的短信");
startActivity(intent);
}
});
2. Également via l'intention, définissez l'intention-fifter pour l'activité dans le fichier manifeste du projet récupéré,
en particulier les conditions de définition d'intention dans l'activité, le système utilise l'intention-fifter du fichier manifeste pour trouver le
filtre d'activité cible conditions : 1. Action : Action : 2 .Category : catégorie, qui est également une description supplémentaire de l'
exemple de fichier d'intention AndroidManifest.xml :
<activity
android:name=".jump.InnerJumpActivity"
android:exported="false">
<intent-filter>
<!--1.隐式跳转注意写这个-->
<action android:name="com.studay.base.study.jump.InnerJumpActivity" />
<!--2.隐式跳转注意写这个-->
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
3.Data : données, qui sont également une description supplémentaire de l'intention