Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 0.81 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Android list applications that can view an unknown file
  2. Intent intent = new Intent();
  3. intent.setAction(android.content.Intent.ACTION_VIEW);
  4. intent.setDataAndType(Uri.fromFile(file), "image/*");
  5. context.startActivity(intent);
  6.        
  7. Intent audioIntent = new Intent(android.content.Intent.ACTION_VIEW);
  8.     audioIntent.setDataAndType(Uri.fromFile(Opener.file), "audio/*");
  9.     List<ResolveInfo> audio = packageManager.queryIntentActivities(audioIntent, 0);
  10.     for (ResolveInfo info : audio){
  11.         String label = info.loadLabel(packageManager).toString();
  12.         Drawable icon = info.loadIcon(packageManager);
  13.         String packageName = info.activityInfo.packageName;
  14.         String name = info.activityInfo.name;
  15.         iconlabel.add(a.new HolderObject(label, icon, audioIntent, "audio/*", packageName, name));
  16.     }