简体   繁体   English

Android隐藏的应用程序图标出现在主屏幕上

[英]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.

相关问题 Android Studio:应用程序图标未显示在主屏幕或应用程序列表中 - Android Studio: App icon doesn't appear in the home screen or app list 科尔多瓦android应用程序不显示主屏幕上的图标 - Cordova android app not showing icon on home screen 使用LauncherShortcuts在主屏幕上显示Android App图标 - Android App Icon on Home Screen using LauncherShortcuts Android 主屏幕应用程序图标与不需要的迷你图标徽章 - Android Home Screen App Icon With Unwanted Mini-Icon Badge 如何在主菜单android中以隐藏图标模式启动应用程序 - how to launch app in hidden icon mode at home menu android 以编程方式安装Android应用程序时如何在主屏幕上添加图标? - How to add a icon on home screen while installing an android app programatically? 如何以编程方式在主屏幕应用程序图标android中设置徽章编号? - How set badge number in home screen app icon android programatically? 如何在主屏幕 android 上添加应用程序图标(react-native)? - How to add icon of the app on the home android screen (react-native)? 应用程序启动器图标未显示在 Android 电视的主屏幕中 - app launcher icon is not showing in home screen of android tv 如何在Android的主屏幕上的我的应用程序图标上显示通知计数 - How to show Notification Count on My App Icon on Home Screen in Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM