我无法在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");
}
}
所以请帮助我....提前谢谢...