Java android pick a photo from gallery for a folder

1.3k Views Asked by At

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

3

There are 3 best solutions below

0
CommonsWare On BEST ANSWER

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

0
wzieba On

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);
}
0
rahulrvp On

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