First (I wrote it myself): In my opinion, there are some main activities on the Internet that I don't want to start another application.
// These Codes start the main Activity of another application. Of course, you can also start any Activity.
ComponentName componetName = new ComponentName (
// This is the package name of another application
"Com. poynt. weibo ",
// This parameter is the Activity to be started
"Com. poynt. weibo. ui. IndexActivity ");
Try {
Intent intent = new Intent ();
Intent. setComponent (componetName );
StartActivity (intent );
} Catch (Exception e ){
// Toast. makeText (getApplicationContext (), "You can prompt the user that the application is not found, or do other operations here! ", 0). show ();
}
Copy code
Second
: After the Activity of another program is started, the parameters are passed!
Call another Android program B in app a and transmit data to app B at the same time.
ComponentName componentName = new ComponentName (
"Com. xiaohua. player. activity ",
"Com. xiaohua. player. activity. PlayerActivity ");
Intent intent = new Intent ();
Bundle bundle = new Bundle ();
Bundle. putString ("resUrl", resurl );
Bundle. putSerializable ("picUrlList", picurllist );
Intent. putExtras (bundle );
Intent. setComponent (componentName );
StartActivity (intent );
Note:
Com. xiaohua. player. activity: Package path
PlayerActivity: Activity Class
ResUrl: String type
PicUrlList: array or object
After the application is installed, it can be called as described above.
Accept activity:
Public void getParameterByIntent (){
Intent mIntent = this. getIntent ();
String resUrl = mIntent. getStringExtra ("resUrl ");
String [] picUrlList = (String []) mIntent. getSerializableExtra ("picUrlList ");
If (null! = PicUrlList ){
Int count = picUrlList. length;
For (int I = 0; I <count; I ++ ){
Log. e ("tag", "picUrlList [" + I + "]" + picUrlList );
}
}
}
From: http://hi.baidu.com/huaxinchang/blog/item/5fa81903474097f409fa9305.html
Copy code
Third: Call the activity in another apk in one apk.