0
点赞
收藏
分享

微信扫一扫

android 打开另外一个apk并且传值过去


//...... 设置要启动应用程序的包名 与 要启动的Activity
ComponentName apk2Component = new ComponentName("com.houzhenyu.apk2", "com.houzhenyu.apk2.MainActivity");
//................................................... 创建意图与参数对象
Intent intent = new Intent();
Bundle bundle = new Bundle();
//................................................... 传递给apk2的参数
bundle.putString("userName", "houzhenyu");
bundle.putString("userMail", "goinni@163.com");
//................................................... 将参数对象与apk2组件设置给意图
intent.putExtras(bundle);
intent.setComponent(apk2Component);
//................................................... 启动意图,将会打开apk2
startActivity(intent);


举报

相关推荐

0 条评论