休言女子非英物,夜夜龙泉壁上鸣。这篇文章主要讲述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)】
推荐阅读
- android studio for Mac快捷键大全
- ubuntu 16.04 android studio 开发环境搭建
- Android 简单案例(可移动的View)
- Android 简单案例(onSaveInstanceState 和 onRestoreInstanceState)
- Windows系统添加虚拟串口及CanToolApp功能1的实现
- android selector shape 使用
- Spring Boot Dubbo applications.properties 配置清单
- Android源码解析——LruCache
- Android 动画fillAfter和fillBefore