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 .....