提问人:kenmaro 提问时间:10/31/2023 更新时间:10/31/2023 访问量:24
ByteArray 可以使用 UIImage 在 swift 中显示为图像,但在 Kotlin 中使用 BitmapFactory.decodeByteArray 则不能显示为图像
ByteArray can be shown as image in swift using UIImage, but not in Kotlin using BitmapFactory.decodeByteArray
问:
我正在使用 Swift 和 Kotlin 从 NFC 适配器读取一些字节数组对象, 然后我遇到了一个问题。
按照协议,我得到了长度为 1983 的字节数组,它存储在 [UInt8] 中,只需传递
let uiImage = UIImage(data: data)
但是,在 Kotlin(Android 应用程序)中,我无法显示与
var bitmap = BitmapFactory.decodeByteArray(data, 0, data.size, BitmapFactory.Options())
现在这个位图是空的,只是显示
--- Failed to create image decoder with message 'unimplemented'
java.lang.NullPointerException: bitmap must not be null
我有点困惑是什么原因造成的..
如果有人有任何想法或建议,我将不胜感激,谢谢!
答: 暂无答案
评论