ComponentName可以通过一个应用程序打开另一个应用程序。
Intent intent = new Intent();
// 第一个参数是要开启的应用的包名,第二个参数是类名
ComponentName componentName = new ComponentName("com.example.test",
"com.example.test.MainActivity");
try {
intent.setComponent(componentName);
Bundle bundle = new Bundle();
bundle.putString("A->C", "A to C");
intent.putExtras(bundle);
startActivity(intent);
} catch (Exception e) {
Toast.makeText(this, "提示用户没有找到应用程序,或者是做其他的操作!", Toast.LENGTH_SHORT).show();
}
以上可以用Bundle来传送信息。
转载于:https://blog.51cto.com/10976921/1721931