Android APK Mutual Tune

Source: Internet
Author: User

1. Start the main activity of another application.

This code is the main activity to start another application, and of course you can start any activity          componentname componetname = new ComponentName (                  // This is another application's package name                  "Com.poynt.weibo",                  //This parameter is to start the activity                  "com.poynt.weibo.ui.IndexActivity");              try {                  Intent Intent = new Intent ();                  Intent.setcomponent (componetname);                  StartActivity (intent);              } catch (Exception e) {  ///              Toast.maketext (Getapplicationcontext), "You can be prompted here to not find the application, or to do other things!" ", 0). Show ();                                }  

2. Start the activity of another program and pass the parameters over!

Call another Android program B in an Android application A and pass the data to B componentname componentname = new ComponentName ("Com.xiaohua.pla          Yer.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, can also be an object application after installation, can be called as 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

3. call the activity in an apk with another apk

Intent Intent = new Intent (intent.action_web_search);  Intent.putextra (Searchmanager.query, "SearchString") startactivity (intent);

Reference Link: http://www.apkbus.com/android-43480-1-1.html

Http://android.toolib.net/reference/android/content/ComponentName.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.