android如何添加桌面图标和卸载程序后自动删除图标
- 作者: 五速梦信息网
- 时间: 2026年04月04日 13:51
android如何添加桌面图标和卸载程序后自动删除桌面图标,这是一个应用的安装与卸载过程对桌面图标的操作,下面与大家分享下具体是如何实现的,感兴趣的朋友可以参考下哈
1:创建图标如下
Intent intent = new Intent();
intent.setClass(this, SplashActivity.class);
Intent addShortcut = new Intent(ACTION_ADD_SHORTCUT);
Parcelable icon = Intent.ShortcutIconResource.fromContext(this,
R.drawable.icon);
addShortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));
addShortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent);
addShortcut.putExtra("duplicate", );
addShortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
sendBroadcast(addShortcut);
2:删除图标如下
Intent intent = new Intent();
intent.setClass(this, SplashActivity.class);
intent.setAction("android.intent.action.MAIN");
intent.addCategory("android.intent.category.LAUNCHER");
Intent addShortcut = new Intent(ACTION_ADD_SHORTCUT);
Parcelable icon = Intent.ShortcutIconResource.fromContext(this,
R.drawable.icon);
addShortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));
addShortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent);
addShortcut.putExtra("duplicate", );
addShortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
sendBroadcast(addShortcut);
intent.setAction("android.intent.action.MAIN");
intent.addCategory("android.intent.category.LAUNCHER");
需要两个过滤属性
相关文章
-
android设置textview字体 手机里的字体
android设置textview字体 手机里的字体
- 互联网
- 2026年04月04日
-
android设置光标位置
android设置光标位置
- 互联网
- 2026年04月04日
-
Android使用surface直接显示yuv数据(三)
Android使用surface直接显示yuv数据(三)
- 互联网
- 2026年04月04日
-
Android如何解析json数组对象
Android如何解析json数组对象
- 互联网
- 2026年04月04日
-
Android权限管理之RxPermission解决Android 6.0 适配问题
Android权限管理之RxPermission解决Android 6.0 适配问题
- 互联网
- 2026年04月04日
-
Android请求网络共通类——Hi
Android请求网络共通类——Hi
- 互联网
- 2026年04月04日








