Bitmap is returning null from BitmapFactory.decodeFile(filename)

前端 未结 14 1059
悲哀的现实
悲哀的现实 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:17

    It's simple: your file either is not an image or image that is not supported by Android's Bitmap implementation, or you path is invalid.


    See documentation for BitmapFactory.decodeFile(String file):

    Returns
    the resulting decoded bitmap, or null if it could not be decoded.


    Usually when bitmap cannot be decoded some logs are printed to logcat. Inspect them carefully.

    0 讨论(0)
  • 2020-11-29 05:17

    I was missing run time permission check on API level greater than 22. Starting Marshmellow

    0 讨论(0)
提交回复
热议问题