-
//1.给intent维护图标和名称
-
Intent intent = new Intent( "com.android.launcher.action.INSTALL_SHORTCUT");
-
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher));
-
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "ShortCut");
-
//2.点击快捷方式进入应用
-
Intent shortCutIntent = new Intent();
-
shortCutIntent.setAction( "android.intent.action.splash");
-
shortCutIntent.addCategory( "android.intent.category.DEFAULT");
-
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortCutIntent);
-
sendBroadcast(intent);
-
Toast.makeText(getApplicationContext(), "快捷方式已生成", 0).show();
Android之生成快捷方式
猜你喜欢
转载自blog.csdn.net/feelinghappy/article/details/80901661
今日推荐
周排行