Android 单击按钮时打开另一个应用程序?

Android 单击按钮时打开另一个应用程序?,android,Android,我有两份申请书ApplicationA和ApplicationB。我必须从应用程序A打开应用程序B。同时我需要向应用程序B发送一些详细信息。如何做到这一点?第一个上下文(可以是活动/服务等) 您有几个选择: 1) 从以下位置使用: 2) 创建一个新包 Intent mIntent = new Intent(this, Example.class); Bundle mBundle = new Bundle(); mBundle.extras.putString(key, value); mInte

我有两份申请书ApplicationAApplicationB。我必须从应用程序A打开应用程序B。同时我需要向应用程序B发送一些详细信息。如何做到这一点?

第一个上下文(可以是活动/服务等)

您有几个选择:

1) 从以下位置使用:

2) 创建一个新包

Intent mIntent = new Intent(this, Example.class);
Bundle mBundle = new Bundle();
mBundle.extras.putString(key, value);
mIntent.putExtras(mBundle);
3) 使用意图的快捷方式方法

Intent mIntent = new Intent(this, Example.class);
mIntent.putExtra(key, value);
新上下文(可以是活动/服务等)


注意:对于所有基本类型、包和序列化包,包都有“get”和“put”方法。我只是出于演示的目的使用字符串

您只需编写一行代码就可以完成这一步

Intent mIntent = new Intent(this,"Here second app package name like com.urproject.urclass.class");
对于send to some details,意味着您可以使用bundle或SharedReference,或者通过使用类名声明static和access

Bundle extras = mIntent.getExtras();
extras.putString(key, value); 
Intent mIntent = new Intent(this,"Here second app package name like com.urproject.urclass.class");
Bundle extras = mIntent.getExtras();
extras.putString(key, value);