1

Can you help me how to open gallery in specified folder using intent? It only opening gallery from specified folder like this (screenshot below).

However, it is not returning any value or activity.

I've try a lot of methods, but none open the specified gallery folder

I tried

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

This works, but only opening gallery, not in specified folder

another one

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getPath() + "/CameraExample/");
intent.setDataAndType(uri, "*/*");
startActivity(Intent.createChooser(intent, "Open folder"));

this will open recent file, but it's not just viewing gallery, it choose a file, and return it.

Intent intent = new Intent();
Uri uri = Uri.parse(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getPath() + "/CameraExample/");
intent.setDataAndType(uri, "*/*");
intent.setAction(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

and it only shows a whitescreen. Is it possible to open gallery in specified folder? It would open like this if possible:

Screenshot - opening gallery in folder

Francis Bartkowiak
  • 1,374
  • 2
  • 11
  • 28

2 Answers2

0

is it possible to open gallery in specified folder?

No, sorry.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
0

The gallery selection was not designed to be opened from any location like that. Supported locations:

  1. Album location( /sdcard/dcim)
Remario
  • 3,813
  • 2
  • 18
  • 25
  • also why are you just starting the activity shouldn't you be using startActivityForResult, check this answer: https://stackoverflow.com/questions/6016000/how-to-open-phones-gallery-through-code – Remario Jan 26 '18 at 20:21
  • I've tried it, it's selecting an image and return value.. what I want is only showing gallery in specified folder, so it's separated from my apps.. so I think it's imposible – RIYANDI SAPUTRA Jan 26 '18 at 20:31