Comments very detailed see, just add a intent intent, then send the broadcast on OK
/*** Creating a shortcut * /Private void CreateShortcut() {//Create a shortcut for intentIntent shortcutintent =NewIntent ("Com.android.launcher.action.INSTALL_SHORTCUT");//Do not allow duplicate creationShortcutintent.putextra ("Duplicate",false);//The name of the shortcutShortcutintent.putextra (Intent.extra_shortcut_name,shortcut_name);//Shortcut iconparcelable icon = Intent.ShortcutIconResource.fromContext (mainactivity. This, r.mipmap.shortcut);//Set iconShortcutintent.putextra (Intent.extra_shortcut_icon_resource, ICON);//Click on the shortcut picture, run the program main entranceIntent Intent =NewIntent (mainactivity. This, Mainactivity.class); Shortcutintent.putextra (Intent.extra_shortcut_intent, Intent);//Send a broadcast, create a shortcutSendbroadcast (shortcutintent); Toast.maketext (mainactivity. This,"Shortcut Creation", Toast.length_short). Show ();}
App Add Desktop Shortcut