I'm trying to show all thumbnails (path) stored locally in device.
I do it in two steps
map
<id, thumbnailPath>
SparseArrayCompat<String> result = new SparseArrayCompat<String>(); Cursor thumbCursor = null; thumbCursor = getContentResolver().query( MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, null, null, null, null); if (thumbCursor.moveToFirst()) { do { String path = thumbCursor.getString(thumbCursor .getColumnIndex(MediaStore.MediaColumns.DATA)); int imageId = thumbCursor.getInt(thumbCursor .getColumnIndex(MediaStore.Images.Thumbnails.IMAGE_ID)); result.put(imageId, path); } while(thumbCursor.moveToNext()); } thumbCursor.close(); return result;
get all images' ids and iterate to get the thumbnail
Cursor cursor = cr.query( Images.Media.EXTERNAL_CONTENT_URI, null, null, null, Images.ImageColumns.DATE_MODIFIED + " DESC");
// retrieve thumbnail_path using the image's id (which is obtained from the above cursor)
However, some of images don't have thumbnail_path. (not found in the first mapping)
Not all images in gallery have a thumbnail image associated with it?