Android Shortcut Shortcut Management

Source: Internet
Author: User

The following 58 effects of the same city shortcut:



Here's how to add a desktop shortcut:

/** * Start an activity that needs to be defined in manifest <intent-filter> <action * android:name= "Android.intent.action.MAIN"/ > </intent-filter> * *private void Addshortcut () {//installed intentintent shortcut =new Intent ("Com.android.launcher.action.INSTALL_SHORTCUT"); /Shortcut name Shortcut.putextra (intent.extra_shortcut_name, "Home");//shortcut icon is allowed to repeat Shortcut.putextra ("duplicate", false); Intent Shortcutintent = new Intent (), Shortcutintent.putextra ("Tname", "Home");//Shortcutintent.setclass (Mcontext, Housejjactivity.class); Shortcutintent.setclassname ("Com.shangc.houseproperty","Com.shangc.houseproperty.ui.activity.TestActivity"); Shortcutintent.setflags (Intent.flag_activity_new_task); Shortcut.putextra (Intent.extra_shortcut_intent, shortcutintent);//shortcut icon Shortcuticonresource iconres =intent.shortcuticonresource.fromcontext (MContext, R.drawable.ic_launcher); Shortcut.putextra (Intent.extra_shortcut_icon_resource, iconres);// Send broadcast mcontext.sendbroadcast (shortcut);}

Launch a translucent activity through the icon, in this activity to manage gadgets or something. It's important to note that it's red .... It didn't work for a long time, prompting you to apply an error that was not installed.

Of course remember to add permission:

<uses-permission android:name= "Com.android.launcher.permission.INSTALL_SHORTCUT"/>    < Uses-permission android:name= "Com.android.launcher.permission.UNINSTALL_SHORTCUT"/>

Translucent activity is simple .....

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.