我无法在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");
}
}
所以请帮帮我.... 提前谢谢......
答案 0 :(得分:3)
如果您不想在应用上设置启动器图标,请不要将“LAUNCHER”类别放在“AndroidManifest.xml”文件的任何活动中。该类别如下所示:
<category android:name="android.intent.category.LAUNCHER" />
答案 1 :(得分:0)
删除
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
从您的清单中查看所有活动。