0

I write this code which open gallery with all folder:

{
    Intent intent = new Intent();
    intent.setAction(android.content.Intent.ACTION_VIEW);
    intent.setType("image/*");
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);
}

But I want to open an specific folder with built-in Gallery. I search about this and I found some people posted about this problem in stack overflow but there was no perfect sollution in any post. Can anyone help me?

Nurul Alom Ador
  • 377
  • 1
  • 2
  • 10
  • "But I want to open an specific folder with built-in Gallery" -- there are hundreds of "built-in Gallery" apps, spread across the > 26,000 Android device models. None have to support any `Intent` action to show some specific image collection, such as what is contained in a filesystem directory. – CommonsWare Nov 09 '20 at 12:22

1 Answers1

0

The location of photos is always the same - it’s the DCIM/Camera folder. The full path looks like this:

  • /storage/emmc/DCIM - if the images are on the phone memory.
  • /storage/sdcard0/DCIM - if they are on memory card.

OR by code.

private static String getGalleryPath() {
        return photoDir = Environment.getExternalStorageDirectory() + "/" + Environment.DIRECTORY_DCIM + "/";   
    }

and to open these specific folders you can [follow this answer.][1] https://stackoverflow.com/a/10749615/1371792
GreenROBO
  • 4,725
  • 4
  • 23
  • 43