两个程序传值

App1...
Intent i = new Intent("com.xxx.yyy.MESSAGE");
Bundle b = new Bundle();
b.putString("AAA", getAAA());
i.putExtra("MyData", b);
startActivityForResult(i, "myProcess");

 

App2... onResume()...

 Intent i = getIntent();
 if (i != null && i.getAction().equals("com.xxx.yyy.MESSAGE") {
    ...get the data from the bundle
 }

 

AndroidManifest.xml (App2)
 <intent-filter>
    <action android:name="com.xxx.yyy.MESSAGE"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <data android:mimeType="text/plain"/>
 </intent-filter>

 

你可能感兴趣的:(程序)