拿到能打开指定类型文件的应用程序

Intent it = new Intent();
it.setType("image/*")
List<ResolveInfo> ra = this.getPackageManager().queryIntentActivities(it,0);  

 for(int i=0;i<ra.size();i++){  
    ActivityInfo ai = ra.get(i).activityInfo;  
    Drawable icon = ai.loadIcon(this.getPackageManager());   //图标
    String label = ai.loadLabel(this.getPackageManager()).toString();  //名称 
    ComponentName c = new ComponentName(ai.applicationInfo.packageName, ai.name);   //组件名,可以通过startActivity()打开此应用
 }

如果你要打开其他的媒体资源:videooraudio

指定相应的Type即可!

相关推荐