Learned the call of activity between two applications , and method calls between two applications (implemented using aidl )
Two applications are as follows : from application, to application ( from activity Call to application activity)
Implementation method:
1. Declare the activity of the to application to be invoked in the from manifest file
<application android:allowbackup= "true" android:icon= "@drawable/ic_launcher "Android:label=" @string/app_name "android:theme=" @style/apptheme "> <activity Andro Id:name= "com.example.from.MainActivity" android:label= "@string/app_name" > <intent-filter> <action android:name= "Android.intent.action.MAIN"/> <category android:name= "Androi D.intent.category.launcher "/> </intent-filter> </activity> <activity android:n Ame= "Com.example.to.ToActivity" > <intent-filter> <action android:name= "Android.inte Nt.action.VIEW "> </action> <category android:name=" Android.intent.category.DEFA ULT "> </category> </intent-filter> </activity> </application& gt;
2. The code that is called in the activity is as follows
ComponentName componetname = new ComponentName ( //This is another application's package name "Com.example.to", //This parameter is the activity to start "com.example.to.ToActivity"); try { Intent Intent = new Intent (); Intent.setaction ("Android.intent.action.VIEW");//bundle bundle = new Bundle ();//bundle.putcharsequencearray ("Val", New string[]{"111", "222", "333", "444"});//intent.putextras (bundle);//Bind bundle data//intent.setcomponent ( Componetname); StartActivity (intent); } catch (Exception e) {toast.maketext (Getapplicationcontext (), "You can prompt the user not to find the application, or to do other things! ", 0). Show (); LOG.V ("Go to apk Error", "------>" +e.tostring ());}
Since we are calling the to application from the From app, we also need to set the properties for the activity to be called in the to application, as follows:
<activity android:name= "com.example.to.ToActivity" android:exported= "true" > </activity>
Android One app activity invokes another app's activity