我需要从菜单中隐藏我的图标应用程序,我已尝试过这个
PackageManager p = getPackageManager();
ComponentName componentName = new ComponentName(Test.this,com.example.MainActivity.class);
p.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
但它不起作用......我怎么能这样做?
答案 0 :(得分:-1)
你在语法上犯了一个错误。改变如下:
PackageManager p = getPackageManager();
ComponentName componentName = new ComponentName("com.example","com.example.MainActivity");
p.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
它会像魅力一样工作!!