Android之生成快捷方式

来源:互联网 发布:ff14男性捏脸数据 编辑:程序博客网 时间:2024/06/05 06:36

比较简单,直接上代码:

                //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();


1 0
原创粉丝点击