允许用户从启动器中删除应用程序图标?
我试图以编程方式允许用户决定何时从启动器中删除我的应用程序(从另一个应用程序调用的主题)。
当前使用按钮:
getPackageManager().setComponentEnabledSetting(new ComponentName("com.package.name","Main"),PackageManager.COMPONENT_ENABLED_STATE_DISABLED,0);
抱歉,我不是编码员,我做错了什么,按钮显示,但即使启动器或手机重新启动也没有效果。
有想法吗?
I'm trying to programatically allow the USER to decide when to remove my app (a theme which is called from another app) from the launcher.
Currently using a button:
getPackageManager().setComponentEnabledSetting(new ComponentName("com.package.name","Main"),PackageManager.COMPONENT_ENABLED_STATE_DISABLED,0);
Sorry I'm not a coder and I'm doing something wrong, the button shows but no effect even with a launcher or phone restart.
Ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我实际上发现了一些其他有效的类似代码。
我将
intent.category.LAUNCHER
和intent.action.MAIN
保留在 Main 中,并将调用我的应用程序的意图从父应用程序移至一个新班级(废话)。然后,我在按下按钮时运行以下命令,用户可以通过该按钮从启动器中删除图标(需要启动器/手机重新启动):
OK, I actually found some other similar code which worked.
I had kept
intent.category.LAUNCHER
andintent.action.MAIN
in Main and moved the intent that calls my app from a parent app into a new class (duh).Then I run the folowing on a button press by which the user can remove the icon from the launcher (requires launcher/phone restart):
为什么首先要有一个启动器图标(必要的)?主题需要这样的图标吗?
除此之外:在这里提出了同样的问题并得到了回答:必须重新启动启动器本身才能更新图标列表。
Why is there even a launcher icon (necessary) in the first place? Does a theme need such an icon?
Apart from that: the same question was asked and answered here: you have to restart the launcher itself to update the icon-list.