The example in this article describes the Android programming approach to creating shortcuts for programs. Share to everyone for your reference, specific as follows:
/**
* Create desktop shortcuts for programs
/private void Addshortcut () {
Intent shortcut = new Intent (" Com.android.launcher.action.INSTALL_SHORTCUT ");
The name of the shortcut
Shortcut.putextra (intent.extra_shortcut_name, getString (R.string.app_name));
Shortcut.putextra ("duplicate", false); Do not allow duplicate creation
//Specify the object that the current activity starts for the shortcut: such as
//com.everest.video.videoplayer
//NOTE: The second parameter of the componentname must be preceded by a dot (.), otherwise the shortcut will not start the appropriate program
componentname comp = new ComponentName (This.getpackagename (), "." +this.getlocalclassname ());
Shortcut.putextra (Intent.extra_shortcut_intent, New Intent (Intent.action_main). SetComponent (comp));
Shortcut icon
shortcuticonresource iconres = Intent.ShortcutIconResource.fromContext (this, r.drawable.icon);
Shortcut.putextra (Intent.extra_shortcut_icon_resource, iconres);
Sendbroadcast (shortcut);
}
I hope this article will help you with the Android program.