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

后端 未结 2 1177
北海茫月
北海茫月 2021-02-19 19:23

Consider the scenario as in this picture:

Three photos, one of them is a large GIF file (3MP).

I\'m querying MediaStore in order to retrieve the corre

2条回答
  •  悲&欢浪女
    2021-02-19 19:58

    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);
    

提交回复
热议问题