0

I don't know how I can pick a photo from gallery from one folder :

Now I have this :

   private void galleryIntent() {
        Intent intent = new Intent();
        intent.setType("image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);//
        startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE);
}

But now I can choose a photo from all gallery and I wanto to pick a photo from a folder Test

Ankita Shah
  • 1,866
  • 16
  • 31
Krzysztof Pokrywka
  • 1,356
  • 4
  • 27
  • 50

3 Answers3

1

Integrate some sort of picker into your own app, such as perhaps one of these file/directory chooser libraries, and remove ACTION_GET_CONTENT.

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

Try with

private void galleryIntent() {
        Intent intent = new Intent();
        //Write your path here
        Uri uri=Uri.parse(Environment.getDownloadCacheDirectory().getPath().toString());
        intent.setDataAndType(uri, "image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);//
        startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE);
}
wzieba
  • 414
  • 2
  • 6
  • 21
1

You might consider checking this answer. Looks promising. But does not work if you have no file manager installed it seems.

https://stackoverflow.com/a/17173655/1987045

Community
  • 1
  • 1
rahulrvp
  • 2,006
  • 1
  • 19
  • 26