Issue
I want to convert byte array to image and show it in image view, but not sure how to do it. Can someone guide me please
I use this function to convert bitmap to byte array
private fun BitmapToByteArray(): ByteArray
{
val stream = ByteArrayOutputStream()
btm1!!.compress(Bitmap.CompressFormat.PNG, 100, stream)
val bitmapdata: ByteArray = stream.toByteArray()
return bitmapdata
}
Solution
Try with this :
fun byteArrayToBitmap(data: ByteArray): Bitmap {
return BitmapFactory.decodeByteArray(data, 0, data.size)
}
Answered By - Shay Kin
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.