AndroidPackageManager(queryIntentActivities)

休言女子非英物,夜夜龙泉壁上鸣。这篇文章主要讲述AndroidPackageManager:queryIntentActivities相关的知识,希望能为你提供帮助。

Intent intent = new Intent(Intent.ACTION_MAIN, null); intent.setPackage(getPackageName()); intent.addCategory(Intent.CATEGORY_SAMPLE_CODE); PackageManager pm = getPackageManager(); List< ResolveInfo> infos = pm.queryIntentActivities(intent, 0); ArrayList< SampleInfo> samples = new ArrayList< SampleInfo> (); final int count = infos.size(); for (int i = 0; i < count; i++) { final ResolveInfo info = infos.get(i); final CharSequence labelSeq = info.loadLabel(pm); String label = labelSeq != null ? labelSeq.toString() : info.activityInfo.name; Intent target = new Intent(); target.setClassName(info.activityInfo.applicationInfo.packageName, info.activityInfo.name); SampleInfo sample = new SampleInfo(label, target); samples.add(sample); }

【AndroidPackageManager(queryIntentActivities)】 

    推荐阅读