/** * * [添加快捷方式]<BR> * [功能详细描述] */ private void addShortcut() { Intent shortcut = new Intent( "com.android.launcher.action.INSTALL_SHORTCUT"); shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name)); shortcut.putExtra("duplicate", false); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setClass(this, TestActivty.class); shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent); ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext( this, R.drawable.icon); shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconRes); sendBroadcast(shortcut); } /** * * [快捷方式是否安装]<BR> * [功能详细描述] * * @return */ private boolean isInstallShortcut() { boolean flag = false; final ContentResolver cr = this.getContentResolver(); final String AUTHORITY = "com.android.launcher.settings"; final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/favorites?notify=true"); Cursor c = cr.query(CONTENT_URI, new String[] {"title", "iconResource" }, "title=?", new String[] {getResources().getString(R.string.app_name) }, null);// XXX表示应用名称,需要判断什么就修改成什么 if (c != null && c.getCount() > 0) { flag = true; } return flag; }

更多相关文章

  1. Android的拖拉功能-彩球示例
  2. Android判断程序是否第一次运行
  3. android 监听判断软键盘的弹出、隐藏状态
  4. android 判断是否第一次进入欢迎页
  5. Android(安卓)之内置内存卡与外置存储卡判断
  6. android 判断是否第一次进入欢迎页
  7. android录像预览功能
  8. 【阿里云镜像】切换阿里巴巴开源镜像站镜像——Fedora镜像
  9. 【阿里云镜像】切换阿里巴巴开源镜像站镜像——Debian镜像

随机推荐

  1. 第125天:Flask 项目结构
  2. 主流技术栈的Restful API接口测试实战
  3. Oracle OCR的备份与恢复
  4. Oracle kill session相关问题
  5. 第126天:Seaborn-可视化统计关系
  6. 《Oracle DBA工作笔记》第二章 常用工具
  7. 理论实践:循序渐进理解AWR细致入微分析性
  8. 【故障处理】 DBCA建库报错CRS-2566
  9. 【JS基础入门】JavaScript基础之事件的操
  10. 如何让百度收录我们自己的网站呢?