Bitmap is returning null from BitmapFactory.decodeFile(filename)

前端 未结 14 1151
悲哀的现实
悲哀的现实 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 05:12

    A clear explanation is given in google documentation https://developer.android.com/topic/performance/graphics/load-bitmap#java

    Setting the inJustDecodeBounds property to true while decoding avoids memory allocation, returning null for the bitmap object.

    as per @Jeroen VL changing options.inJustDecodeBounds = false solved the problem

提交回复
热议问题