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

问题描述:

因此,我想在第一次运行后隐藏启动程序中的图标。图标已从发射器中消失,但它仍然出现在主屏幕上。主屏幕上出现Android隐藏应用程序图标

我已经看到类似的应用程序 - 他们可以从启动器应用程序列表中删除自己的图标,他们的图标也不会出现在主屏幕上。

我用下面的代码来隐藏应用程序图标。我犯了什么错误?为什么应用图标出现在主屏幕上?

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); 

注:图标从主屏幕三星Galaxy S4迷你(4.4.2),但它走了出现在三星Galaxy S3(4.3.0)的主屏幕上。任何建议,帮助赞赏

预先感谢您..

+0

这件事做任何箱子LAUNCHER活动清单档案中的 – 2014-09-04 07:04:37

+0

抱歉,但我无法理解你解释我是什么什么意思。 Plealse be elaborate – 2014-09-04 07:06:27

+1

为什么你想从主屏幕上隐藏应用程序 – 2014-09-04 07:10:11

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); 
}