Why does BitmapFactory.decodeByteArray return null?

后端 未结 7 874
失恋的感觉
失恋的感觉 2020-11-28 16:02

It\'s the simple code and instead of getting result to set the Bitmap, I get null. Can anyone tell me where I am making a mistake?

String test = \"test\";
by         


        
7条回答
  •  广开言路
    2020-11-28 16:21

    You're trying to parse a String as a bitmap. BitmapFactory.decodeByteArray() will fail unless there is a valid bitmap in the byte array. In this case there isn't, so it returns null.

提交回复
热议问题