1.Manifast.xml文件中添加权限:

<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />

2.发送广播:

Intent addIntent=new Intent("com.android.launcher.action.INSTALL_SHORTCUT");        Parcelable icon=Intent.ShortcutIconResource.fromContext(this, R.drawable.ic_launcher); //获取快捷键的图标        Intent myIntent=new Intent(this, MainActivity.class);        addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "快捷方式名字");//快捷方式的标题        addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);//快捷方式的图标        addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, myIntent);//快捷方式的动作        sendBroadcast(addIntent);

更多相关文章

  1. android 创建快捷方式图标
  2. Android图标靠界面的右边的实现
  3. 修改android桌面图标默认大小
  4. Android Studio快捷键、配置 Android Studio、cmake配置Android
  5. android studio 快捷键描述和设置
  6. android快捷键
  7. Android多分辨率适配实践【1】使用字体图标(内含两枚神器)

随机推荐

  1. MySQL的ibdata1文件占用过大瘦身
  2. 数据库keepalived部署文档
  3. 为什么我们的查询卡在MySql中的“写入网
  4. linux环境下写C++操作mysql(一)
  5. 蜂巢和数据库之间的完整性检查
  6. sql随机获获取数据
  7. 替换wordpress WP_POSTS表中post_date字
  8. mysql的count方法详解
  9. Spring+SpringMVC+MyBatis+easyUI整合基
  10. navicat for mysql 注册码,简简单单,一个搞