开发者

Android: getting thumbnails from specific location on sd card

开发者 https://www.devze.com 2023-01-03 12:52 出处:网络
AFAIK accessing thumbnails for images via MediaStore.Images.Thumbnails would generate thumbnails at first attempt, and that\'s what I need to perform against specific location on sd card.

AFAIK accessing thumbnails for images via MediaStore.Images.Thumbnails would generate thumbnails at first attempt, and that's what I need to perform against specific location on sd card.

The question is how to make valid URI to content under specific folder?

All answers I can find use just MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI as uri to make managedQuery. And result of it is Cursor that points to all sdcard i开发者_如何学Cmages, while none examples can be found on how to access only specific folder.


Maybe you could just list files in the directory and parse them to get thumbnails without using content provider. You can use inSampleSize option to get small bitmap not the complete image Strange out of memory issue while loading an image to a Bitmap object.


may be is to late, but for some one will be helpfull

Mihai Fonoage said...

Use something like

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

Here you have some great tutorial.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号