简体   繁体   中英

Android open folder image with built-in gallery

I want to open a images folder with android built-in gallery. For example, I have a folder path that contains images, i want to open it with gallery. I am using this code, it opens the gallery that contains no images. Any idea?

    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(new  File(folderImages)),"image/*");
    startActivityForResult(intent, 1);

Maybe try this one:

Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, ""), 1)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM