views:

269

answers:

1

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 images, while none examples can be found on how to access only specific folder.

A: 

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 http://stackoverflow.com/questions/477572/823966#823966.

Fedor
when the size varies very much it would be hard to guess the factor for inSampleSize without loading full image to know it's width and height in order to shrink it to default thumb size (i.e. 90x90)
dykzei
You can use justDecodeBound option http://developer.android.com/reference/android/graphics/BitmapFactory.Options.html#inJustDecodeBounds. It will return you the bitmap size without decompressing the complete image and allocating memory. Knowing image size you can calculate the required inSampeSize factor for each image.
Fedor