Android上获取打开apk默认关联的图标.

PackageManager pm = mContext.getPackageManager();
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromParts("file", "", null), mimeType); // mimeType 必须要知道文件的mimeType
PackageManager pm = mContext.getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(intent,PackageManager.MATCH_DEFAULT_ONLY);
Drawable icon = list.get(0).activityInfo.loadIcon(pm);

你可能感兴趣的:(android,list,File,null)