// 创建添加快捷方式的Intent
Intent addIntent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
String title = getResources().getString(R.string.app_name);
// 加载快捷方式的图标
Parcelable icon = Intent.ShortcutIconResource.fromContext(WelcomeActivity.this, R.drawable.icon);
// 创建点击快捷方式后操作Intent,该处当点击创建的快捷方式后,再次启动该程序
Intent myIntent = new Intent(WelcomeActivity.this,WelcomeActivity.class);
// 设置快捷方式的标题
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, title);
// 设置快捷方式的图标
addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
// 设置快捷方式对应的Intent
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, myIntent);
// 发送广播添加快捷方式
sendBroadcast(addIntent);

更多相关文章

  1. Android4.1 Rotation 小结
  2. Android(安卓)EditText达到SearchView的效果
  3. Android(安卓)Studio设置类代码模板
  4. android通过反射来获取系统属性SystemProperties
  5. android 自带的下拉刷新控件,含Demo(SwipeRefreshLayout控件)
  6. Android创建应用程序快捷方式(shortcut)
  7. Android初级教程调用手机拍照与摄像功能
  8. Android获取高清app图标代码分享
  9. Android(安卓)4.0 创建AVD报错

随机推荐

  1. 转: [Android]获取未安装的APK信息
  2. Android SQLite增删改查基本用法,通讯录实
  3. android 自适应 多屏幕支持 .
  4. 尼尔森:Android市场份额上升至43%
  5. Android中Bitmap的剪切与拉伸
  6. 68.android 简单的布局展示不全的问题,明
  7. Android中不被硬件加速支持的操作
  8. Android最新组件RecyclerView,替代ListVie
  9. 详解Android中Handler的内部实现原理
  10. 认识Android MVP