[英]Hide icon of installed app in android
我無法隱藏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");
}
}
所以請幫助我....提前謝謝......
如果您不想在應用程序上安裝啟動器圖標,請不要將“LAUNCHER”類別放在“AndroidManifest.xml”文件的任何活動中。 該類別如下所示:
<category android:name="android.intent.category.LAUNCHER" />
去掉
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
從你的所有活動的清單。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.