Android How to Do app icon Hide, launched by a third party program

Source: Internet
Author: User

In your app's androidmanifest.xml, make the following changes to the startup page

< Intent-filter >     <  android:name= "Android.intent.action.MAIN"/>     <   android:name= "Android.intent.category.DEFAULT"/>  </  intent-filter>

In a third-party program, call the following

New Intent (Intent.action_main); Intent.setcomponent (new componentname ("Com.test.app",           "com.test.app.MainActivity")); Intent.addflags (Intent.flag_activity_new_task); StartActivity (intent) ;

Where Com.test.app is the application package name, and Com.test.app.MainActivity is the first activity you want to start, that is, the start page referred to above

If you do not know the startup page, or your startup page will change, you can also call the following

 Public BooleanstartApp (String packagename) {Intent Intent=NewIntent (Intent.action_main,NULL);          Intent.addcategory (Intent.category_default); Packagemanager pm=Getpackagemanager (); List<ResolveInfo> Listinfos = pm.queryintentactivities (Intent, 0); String ClassName=NULL;  for(ResolveInfo info:listinfos) {if(Packagename.equals (info.activityInfo.packageName)) {ClassName=Info.activityInfo.name;  Break; }          }          if(ClassName! =NULL&& classname.length () > 0) {intent.setcomponent (Newcomponentname (PackageName, className)); Intent.setflags (Intent.flag_activity_new_task|intent.flag_activity_reset_task_if_needed);           StartActivity (Intent); return true; }          return false; }

Android How to Do app icon Hide, launched by a third party program

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.