开发者

Duplicated thumbnail and some images thumbnails not shown in my android app

I used the MediaStore.images.thumbnail.external_content_uri to query the thumbnail on the phone. It works ok with my new phone with some photos taken from camera or the download开发者_如何学编程 images from browser.

When using it one friends phone, there are some thumbnails duplicated shown on the gridview and some not even shown.

Do I need to rescan the media before querying the thumbnails in the mediastore.


My experience in working with MediaStore.images.thumbnail is that it cannot be trusted. I guess this is due to different implementation of phone vendors. For example, on my HTC, the thumbnails of gallery is cached by itself (since it is not standard size), not via MediaStore, so those entries are absent in MediaStore. (PS, entries in MediaStore.images.thumbnail are not essentially mapped to an existing picture, that means, it may have an entry on Picture A, if later on you removed Picture A, the thumbnail could still be there pointing to nothing)

The more reliable way is to query the ID of Images from MediaStore.images, and then use MediaStore.images.thumbnails.getThumbnail to retrieve the Image with the IDs.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜