Kkk.
Kkk.

Reputation: 1

Java android pick a photo from gallery for a folder

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

Upvotes: 0

Views: 1363

Answers (3)

rahulrvp
rahulrvp

Reputation: 2136

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

Upvotes: 1

wzieba
wzieba

Reputation: 414

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);
}

Upvotes: 1

CommonsWare
CommonsWare

Reputation: 1007533

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

Upvotes: 1

Related Questions