MediaStore.Images.Thumbnails.getThumbnail returns wrong thumbnail instead of NULL

社会主义新天地 提交于 2019-12-04 02:08:50

I"m just guessing here. When you ask for the MICRO_KIND the os is creating a new image which gets next in line on DESC cursor producing the same image again.

One work around is to load an ArrayList for the image id's. Then to go after the thumbnails working from the ArrayList.

Possibility try your code using the MINI_KIND and bmoptions.inSampleSize = 2;

 final BitmapFactory.Options bmOptions = new BitmapFactory.Options();
            bmOptions.inSampleSize =2;



                    Bitmap bm = MediaStore.Images.Thumbnails.getThumbnail(
                            context.getContentResolver(), newImageId,
                            MediaStore.Images.Thumbnails.MINI_KIND,
                            bmOptions);

After three years, it seems that this issue is fixed in Lollipop. (The last comment on that thread).
Therefore I'm answering my own question.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!