[英]Android hidden app icon appear on home screen
As such I want to hide the icon from the launcher after the first run. 因此,我想在第一次运行后从启动器中隐藏该图标。 icon is gone from launcher but its still appear on home screen.
图标从启动器中消失了,但仍显示在主屏幕上。
I have seen similar applications - they can remove their own icons from the launcher app list.and their icons are not appear on home screen too. 我见过类似的应用程序-他们可以从启动器应用程序列表中删除自己的图标,并且它们的图标也不会出现在主屏幕上。
i used following code to hide app icon. 我用下面的代码来隐藏应用程序图标。 what i had made mistake ?
我犯了什么错? why app icon appear on home screen ?
为什么应用程序图标出现在主屏幕上?
PackageManager p = getPackageManager();
ComponentName componentName = new ComponentName(this,
com.aaa.xxx.dex.abc.class);
p.setComponentEnabledSetting(componentName,
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);
note: icon gone from home screen samsung galaxy S4 mini ( 4.4.2 ), but it appear on home screen on samsung galaxy S3 ( 4.3.0 ) . 注意:图标从主屏幕Samsung galaxy S4 mini(4.4.2)消失,但出现在Samsung Galaxy S3(4.3.0)的主屏幕上。 any suggestions , help appreciated
任何建议,帮助赞赏
thank you in advance .. 先感谢您 ..
public void HideApp()
{
Intent localIntent = new Intent(cx.getApplicationContext(), yourClassName.class);
cx.getApplicationContext().startService(localIntent);
cx.getPackageManager().setComponentEnabledSetting(newComponentName(cx,yourClssName.class), 2, 1);
}
public void Appear()
{
PackageManager pm = context.getApplicationContext().getPackageManager();
pm.setComponentEnabledSetting(new ComponentName(context, yourClassName.class),
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.