android创建桌面快捷方式
仿照微信或是淘宝网,发送快捷方式到桌面,主要代码如下: // 安装的Intent Intent shortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT"); // 快捷名称 shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, tName); // 快捷图标是允许重复 shortcut.putExtra("duplicate", false); Intent shortcutIntent = new Intent(Intent.ACTION_MAIN); shortcutIntent.putExtra("tName", tName); shortcutIntent.setClassName("com.hession.shortcut", "com.hession.shortcut.MainActivity"); shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); // 快捷图标 ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(this, R.drawable.shortcut); shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconRes); // 发送广播 sendBroadcast(shortcut);
- 1
- 粉丝: 1
- 资源: 9
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助