Android: getting thumbnails from a specific location on an SD card

AFAIK, receiving thumbnails for images through MediaStore.Images.Thumbnails, will generate thumbnails on the first try and what I need to do against a specific location on the SD card.

The question is how to make a valid URI for content in a specific folder?

All the answers I can find use only MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URIas uri to do managedQuery. And the result of this is Cursor, which points to all SDK images, while there are no examples to access only a specific folder.

+3
source share
2 answers

, , . inSampleSize Bitmap.

0

, -

...

-

File imagesDir = new File(Environment.getExternalStorageDirectory().toString() + "/pathToDirectory");
File[] imageList = imagesDir.listFiles();
for (File imagePath : imageList) {
bitmap = BitmapFactory.decodeStream(imagePath.toURL().openStream());}

.

0

Source: https://habr.com/ru/post/1749824/


All Articles