android 创建快捷方式
2012-01-03 17:11
267 查看
首先需要权限:
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
Intent intent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT"); ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(this, R.drawable.icon); //图标 intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconRes); intent.putExtra(Intent.EXTRA_SHORTCUT_NAME,getString(R.string.app_name)); //名称 intent.putExtra("duplicate", false); Intent sIntent = new Intent(Intent.ACTION_MAIN); sIntent.addCategory(Intent.CATEGORY_LAUNCHER); sIntent.setClass(this, MainActivity.class); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, sIntent); sendBroadcast(intent);
相关文章推荐
- Android:桌面创建快捷方式
- Android创建和删除桌面快捷方式
- Ubuntu创建Android Studio/Eclipse等快捷方式
- Android创建桌面快捷方式
- Android工具类之创建快捷方式的方法详解
- Android应用程序创建桌面快捷方式
- Android应用创建手机桌面快捷方式
- android创建桌面快捷方式
- Android创建桌面快捷方式并像启动Activity传递参数
- Android创建和删除桌面快捷方式
- android应用创建快捷方式
- Android创建和删除桌面快捷方式
- [Android]为指定的应用创建桌面快捷方式
- Android 创建桌面快捷方式
- Android创建桌面快捷方式所遇到的问题与解决方案
- Android快捷方式(ShortCut)创建以及删除
- Android创建和删除桌面快捷方式
- Android 创建,验证和删除桌面快捷方式 (删除快捷方式测试可用)
- Android中创建和检测快捷方式
- 创建Android快捷方式牛刀小试