11

Assuming I know that the Gallery has an album with a certain name X, what intent or broadcast can I make to open Album X with the Gallery app?

There are plenty of examples showing how to select a picture from the Gallery, but I don't see any describing how to accomplish the above.

Thanks.

amit
  • 1,373
  • 2
  • 16
  • 29
  • take a look at this link http://stackoverflow.com/questions/2507898/how-to-pick-a-image-from-gallery-sd-card-for-my-app-in-android – Nag Feb 29 '12 at 12:07
  • 3
    I don't want user to select an image from the Gallery. I just want to direct them to an album in the Gallery app. – amit Mar 01 '12 at 05:13

2 Answers2

0

If you prepared the Gallery which is called X, yes you can do it.

Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.package.Xapp");
if (launchIntent != null) { 
    launchIntent.setData("PHOTO ID OR ANYTHING ELSE");
    startActivity(launchIntent);
}

After then you can set data in intent. And X app parses intent data and you can open it. Otherwise, you can't this action. You only call the app, If the application does not provide API support for send data with intent.

Umut ADALI
  • 1,146
  • 1
  • 14
  • 31
  • `launchIntent.setData("PHOTO ID OR ANYTHING ELSE")`: That's precisely the issue, what data can we set in order to land on the *album* (with all thumbnails) instead of opening a picture in fullscreen and the swiping left and right (which happens when using a picture URI)? – Pat Lee May 04 '21 at 10:03
  • What I wrote as this PHOTO ID depends on the structure that the application opened out. So setData("album_id", "234234"); If the application supports it, it can be defined as. For example the gallery app allows it; can be used as like intent.setDataAndType(Uri.parse ("file: //" + "/sdcard/test.jpg"), "image / *") – Umut ADALI May 05 '21 at 15:42
  • Any idea on how to figure out that `234234` `album_id`? – Pat Lee May 06 '21 at 12:40
  • You should ask the company that makes the Album X application, if they don't provide this information, no one will know. So it's a specific situation. – Umut ADALI May 06 '21 at 12:45
0

try this

Intent intent = new Intent(); 
intent.setType("image/*");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
Main.this.startActivity(intent); 

program will browser all application are support with image file

but user can set default program

Akexorcist
  • 2,287
  • 1
  • 16
  • 19