一个方法,在APP需要的时候调用该方法即可:

public void createShortcutIconInHomeScreen() {Intent addIntent = new Intent();addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent());addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "快捷方式名字");// 不重复创建快捷方式图标。addIntent.putExtra("duplicate", false);// R.drawable.app_logo 快捷方式的图标icon。addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,Intent.ShortcutIconResource.fromContext(getApplicationContext(), R.drawable.app_logo));addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");getApplicationContext().sendBroadcast(addIntent);}


添加权限:

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


更多相关文章

  1. Android中的多种文件读写操作方法
  2. android 监听其它app的错误或者崩溃的方法 (ProcessErrorStateInf
  3. Android中获取屏幕长宽的方法
  4. Android方法的传递值及其改变
  5. 【Android】打开/读取文件的方法
  6. android 利用startActivityForResult()方法得到另一个Activity的
  7. android studio中rendering problems解决方法
  8. Android之Tab分页标签的实现方法一-----TabActivity和TabHost的
  9. android动态布局方法总结

随机推荐

  1. android:text 文字阴影设置
  2. Android(安卓)相对布局
  3. Java(Android)数据结构汇总 -- 总纲
  4. Android中gravity与layout_gravity的区别
  5. android:theme属性
  6. android EditText inputType说明
  7. [置顶] 个人认为比较好的博文
  8. Android(安卓)xml资源文件中@、@android:
  9. android 解决password过时
  10. Android:在界面中显示以及输入文本信息