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);
}

Android PackageManager:queryIntentActivities的更多相关文章

  1. Android PermissionUtils:运行时权限工具类及申请权限的正确姿势

    Android PermissionUtils:运行时权限工具类及申请权限的正确姿势 ifadai 关注 2017.06.16 16:22* 字数 318 阅读 3637评论 1喜欢 6 Permis ...

  2. Android开发:怎样隐藏自己的app应用

    本文主要介绍怎样通过改动AndroidManifest.xml清单文件来达到隐藏自身应用的目的,不是隐藏第三方应用.为了不浪费大家时间.特此说明. 转载请注明作者xiong_it和链接:http:// ...

  3. Android BottomSheet:以选取图片为例(2)

     Android BottomSheet:以选取图片为例(2) 附录文章5简单介绍了常见的分享面板在BottomSheet中的具体应用.本文再以常见的选取图片为例写一个例子. 布局文件: < ...

  4. Android异常:唤醒锁未授权。(Caused by: java.lang.SecurityException: Neither user 10044 nor current process has android.permission.WAKE_LOCK.)

    Android异常:Caused by: java.lang.SecurityException: Neither user 10044 nor current process has android ...

  5. android studio :com.android.support:appcompat-v7:21.+ 报错

    android studio :com.android.support:appcompat-v7:21.+ 报错: 在project——>app——>build.gradle修改: app ...

  6. Android开发:ScrollView嵌套GridView的解决办法

    Android开发:ScrollView嵌套GridView的解决办法   前些日子在开发中用到了需要ScrollView嵌套GridView的情况,由于这两款控件都自带滚动条,当他们碰到一起的时候便 ...

  7. Android入门:绑定本地服务

    一.绑定服务介绍   前面文章中讲过一般的通过startService开启的服务,当访问者关闭时,服务仍然存在: 但是如果存在这样一种情况:访问者需要与服务进行通信,则我们需要将访问者与服务进行绑定: ...

  8. Android 程式开发:(十三)特殊碎片 —— 13.2 DialogFragment

    Android 程式开发:(十三)特殊碎片 —— 13.2 DialogFragment 原文地址 我们也可以创建另外一种碎片——DialogFragment.顾名思义,DialogFragment就 ...

  9. Android基本功:Handler消息传送机制

    一.什么是UI线程 当程序第一次启动的时候,Android会同时启动一条主线程( Main Thread). 主要负责处理与UI相关的事件. 二.UI线程存在的问题 出于性能优化考虑,Android的 ...

随机推荐

  1. salt '*' state.highstate 报错找不到文件,环境如下No Top file or master_tops data matches found.

    salt '*' state.highstate 报错找不到文件,环境如下No Top file or master_tops data matches found. file_roots:    b ...

  2. CodeIgniter(3.1.4)框架中成功/错误跳转

    if ( ! function_exists('error')) { /** * 错误跳转 */ function error($mes, $url) { echo '<script type= ...

  3. 使用explain分析sql语句

    sql语句优化 : sql语句的时间花在哪儿? 答: 等待时间 , 执行时间. 这两个时间并非孤立的, 如果单条语句执行的快了,对其他语句的锁定的也就少了. 所以,我们来分析如何降低执行时间. : s ...

  4. CI循环数组问题

    当我们在Controll中把数据传递到view中如: $data['cates_data']=$this->Category_Model->byid_data($id); #调用模型层查询 ...

  5. 使用子查询可提升 COUNT DISTINCT 速度 50 倍

    注:这些技术是通用的,只不过我们选择使用Postgres的语法.使用独特的pgAdminIII生成解释图形. 很有用,但太慢 Count distinct是SQL分析时的祸根,因此它是我第一篇博客的不 ...

  6. MapReduce调度与执行原理系列文章

    转自:http://blog.csdn.net/jaytalent?viewmode=contents MapReduce调度与执行原理系列文章 一.MapReduce调度与执行原理之作业提交 二.M ...

  7. selenium测试(Java)-- 键盘事件(七)

    1 package com.test.key; 2 3 import org.openqa.selenium.By; 4 import org.openqa.selenium.Keys; 5 impo ...

  8. Spring 父子容器

    必须要说的是,父子容器是通过设置形成的关系. 容器实现了 ConfigurableApplicationContext 或 ConfigurableBeanFactory 接口,这两个接口中分别有se ...

  9. php -- PHP在linux上执行外部命令,system(),exec(),shell_exec()

    目录:一.PHP中调用外部命令介绍二.关于安全问题三.关于超时问题四.关于PHP运行linux环境中命令出现的问题 一.PHP中调用外部命令介绍 在PHP中调用外部命令,有三种方法: 1. 调用专门函 ...

  10. perl 面向对象编程

    今天看到一个perl面向对象编程的例子,充分体现了如何对数据进行封装: 自己模仿写一个读取配置文件的例子, 配置文件的内容如下 samtools_binary = /usr/bin/samtools ...