Android duplicate thumbnail issue -
Android duplicate thumbnail issue -
i creating custom image , video gallery whatsapp have allow user select multiple image/video,so far populating , showing thumbnails on gridview.but result is,on devices images got shown duplicated , on not.same happens video gallery also.
i quering id of images
mediastore.images
and thumbnails using
mediastore.images.thumbnails.getthumbnail
from obtained ids
below code
final string[] columns = { mediastore.images.media.data, mediastore.images.media._id }; final string orderby = mediastore.images.media.date_added; imagecursor = activity.managedquery(mediastore.images.media.external_content_uri, columns, null,null, orderby+" desc"); int image_column_index = imagecursor.getcolumnindex(mediastore.images.media._id); int count = imagecursor.getcount(); thumbnails = new bitmap[count]; arrpath = new string[count]; log.d("count ", ""+count); int i=0; ( i= 0; <count; i++) { imagecursor.movetoposition(i); int id = imagecursor.getint(image_column_index); int datacolumnindex = imagecursor.getcolumnindex(mediastore.images.media._id); thumbnails[i] = mediastore.images.thumbnails.getthumbnail(context.getcontentresolver(), id,mediastore.images.thumbnails.micro_kind, null); arrpath[i]= imagecursor.getstring(datacolumnindex); }
from android documentation getthumbnail should create thumbnail if not available.
one illustration produce same issue mediastore.images.thumbnails.getthumbnail returns wrong thumbnail instead of null guy hasn't found solution (question asked 2 years ago).
has faced problem,i have gone through many examples , add together more loading cursor in asynctask populating thubnails should not problem adroid os guess.is there solution available issue?its quite frustrating.
i'm not sure if you've found solution problem yet had similar issue. app returning thumbnail uri's didn't point anything. phone call thumbnailutils.createvideothumbnail() prepare reference in content resolver. dropped below app:
bitmap bitmap = thumbnails.getthumbnail(mactivity.getcontentresolver(), videofile.mid, thumbnails.mini_kind, null); if (bitmap == null) { thumbnailutils.createvideothumbnail(videofile.mabsolutepath, thumbnails.mini_kind); }
then told adapter update element affected.
android android-cursor mediastore video-thumbnails
Comments
Post a Comment