1. In the layout file, the target activity is added to the following filter
<intent-filter>
<action android:name= "Android.intent.action.CREATE_SHORTCUT"/>
<category android:name= "Android.intent.category.DEFAULT"/>
</intent-filter>
2. Call by sending a broadcast
Intent shortcut = new Intent ("Com.android.launcher.action.INSTALL_SHORTCUT");
Shortcut.putextra (Intent.extra_shortcut_name, getString (R.string.seckill));//Set the name of the shortcut icon
Shortcut.putextra ("duplicate", false);//Set whether to create repeatedly
Intent Intent = new Intent ();
Intent.addcategory (Intent.category_launcher);
Intent.setclass (Getactivity (), productlistactivity.class);//Set the first page
Shortcut.putextra (Intent.extra_shortcut_intent, Intent);
Shortcuticonresource iconres = Intent.ShortcutIconResource.fromContext (Getactivity (), r.drawable.wx_friend_non);// To set a resource for a shortcut icon
Shortcut.putextra (Intent.extra_shortcut_icon_resource, iconres);
Getactivity (). sendbroadcast (shortcut);
Android Create desktop shortcut (launch target non-project start page)