我无法在android中隐藏已安装的应用。

disableDrawerIcon(“ com.androglobe.androrec”);

public void disableDrawerIcon(String component) {
    try {
        PackageManager pm = this.getPackageManager();
        Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
        mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
        List<ResolveInfo> appList = pm.queryIntentActivities(mainIntent, 0);
        Collections.sort(appList, new ResolveInfo.DisplayNameComparator(pm));
        ComponentName componentName = null;
        for (ResolveInfo temp : appList) {

            if (temp.activityInfo.packageName.equals(component)) {

                componentName = new ComponentName(component,
                        temp.activityInfo.name);

                Log.v(TAG, ""+temp.activityInfo.name);
            }

        }

        if (componentName != null) {


        pm.setComponentEnabledSetting(componentName,
            PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
            PackageManager.DONT_KILL_APP);
        Log.v(TAG, "Icon disabled");

        }
    } catch(Exception e) {
        e.printStackTrace();
        Log.v(TAG, "ERROR");
    }
    }


所以请帮助我。
提前致谢...

最佳答案

如果您不想在应用程序上显示启动器图标,则不要在“ AndroidManifest.xml”文件的任何活动中放置“ LAUNCHER”类别。该类别如下所示:

<category android:name="android.intent.category.LAUNCHER" />

10-08 06:00