Android 一个app启动另一个app
2015-05-26 17:37
447 查看
第一个App中
[java] view
plaincopy
// 通过包名获取要跳转的app,创建intent对象
Intent intent = activity().getPackageManager()
.getLaunchIntentForPackage("com.zsl.download");
// 这里如果intent为空,就说名没有安装要跳转的应用嘛
if (intent != null) {
// 这里跟Activity传递参数一样的嘛,不要担心怎么传递参数,还有接收参数也是跟Activity和Activity传参数一样
intent.putExtra("name", "郑松岚");
startActivity(intent);
} else {
// 没有安装要跳转的app应用,提醒一下
ToastUtils.showLongToast(activity(), "没安装此APP");
}
第二个App中
[java] view
plaincopy
Intent intent = getIntent();
Bundle bundle = intent.getExtras();
if (bundle != null) {
String name = bundle.getString("name");
if (name != null) {
Toast.makeText(getApplicationContext(), "name:" + name, Toast.LENGTH_SHORT).show();
}
}
[java] view
plaincopy
// 通过包名获取要跳转的app,创建intent对象
Intent intent = activity().getPackageManager()
.getLaunchIntentForPackage("com.zsl.download");
// 这里如果intent为空,就说名没有安装要跳转的应用嘛
if (intent != null) {
// 这里跟Activity传递参数一样的嘛,不要担心怎么传递参数,还有接收参数也是跟Activity和Activity传参数一样
intent.putExtra("name", "郑松岚");
startActivity(intent);
} else {
// 没有安装要跳转的app应用,提醒一下
ToastUtils.showLongToast(activity(), "没安装此APP");
}
第二个App中
[java] view
plaincopy
Intent intent = getIntent();
Bundle bundle = intent.getExtras();
if (bundle != null) {
String name = bundle.getString("name");
if (name != null) {
Toast.makeText(getApplicationContext(), "name:" + name, Toast.LENGTH_SHORT).show();
}
}
相关文章推荐
- android开发之在一个APP启动另一个APP
- android 在一个APP中通过包名或类名启动另一个APP
- android 一个app启动另一个App的几种方法
- Android 一个app启动另一个app
- android 一个app 启动另一个app
- android中实现一个APP启动另一个APP并实现类似微信分享
- Android在一个APP中通过包名或类名启动另一个APP
- Android中一个app启动另一个app的指定activity
- Android 通过一个app 启动另一个app
- Android 一个app启动另一个app
- Android 一个app启动另一个app
- 新 Android在一个APP中通过包名或类名启动另一个APP
- Android在一个APP中通过包名或类名启动另一个APP
- Android在一个APP中通过包名或类名启动另一个APP
- Android在一个APP中通过包名或类名启动另一个APP
- Android 一个app启动另一个app
- Android在一个APP中通过包名或类名启动另一个APP
- Android在一个APP中通过包名或类名启动另一个APP
- Android在一个APP中通过包名或类名启动另一个APP
- android 实现一个app启动另一个app的service服务