Bitmap is returning null from BitmapFactory.decodeFile(filename)

前端 未结 14 1114
悲哀的现实
悲哀的现实 2020-11-29 04:19

When I am calling this function there is no image in image view bitmapFactory.decodefile(filename) showing null .. please help for this.

Here is my cod

14条回答
  •  自闭症患者
    2020-11-29 04:55

    The BitmapFactory.decodeFile() executes before the entire image placing in that exact path. When decodeFile() executes there is no image. So the bitmap returns null. Generally the high pixel images takes some extra time to place in their path. So this exception happens.

    Please check the null and try to decodeFile.

    Bitmap bitmap = null;
    
    while(bitmap == null)
       bitmap = BitmapFactory.decodeFile(imageInSD);
    

提交回复
热议问题