-
//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之生成快捷方式
最新推荐文章于 2024-05-15 20:04:51 发布