How to retrieve thumbnail and image filepath with just one query in Android -
How to retrieve thumbnail and image filepath with just one query in Android -
i retrieve file path images , thumbnails 1 query. code below retrieves file paths thumbnails:
final string [] mprojection = {mediastore.images.thumbnails.data}; cursor imagecursor = getcontentresolver().query( mediastore.images.thumbnails.external_content_uri, mprojection, null, null, null ); arraylist<string> thumbfilepaths = new arraylist<string>(); int thumbcolumnindex = imagecursor.getcolumnindex(mediastore.images.thumbnails.data); uri thumburi; while(imagecursor.movetonext()) { thumburi = uri.parse(imagecursor.getstring(thumbcolumnindex)); thumbfilepaths.add(thumburi.getpath()); } imagecursor.close();
i can alter code retrieve file paths image, not sure how alter both image , thumbnail paths retrieved images.
if that's not possible, instead of converting thumb file paths image file paths, has been addressed on stackoverflow, doesn't seem efficient if have many paths, can perform 2 queries - 1 images , 1 thumbs, , order of paths returned both queries same? i.e. nth path returned both queries correspond image , thumbnail paths image n.
also, noticed, of thumbnail paths retrieved multiple times, if can point out what's wrong code, grateful :)
thank you, gary
android image cursor thumbnails android-contentresolver
Comments
Post a Comment