Home » Android » android – conversion of byte array to image

android – conversion of byte array to image

Posted by: admin June 15, 2020 Leave a comment

Questions:

I want to convert a byte array to an image ,For that I used the code

final BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream(decrpt));

where Decrypt is the byte array,It showing error in ImageIO.I dont know what is that parameter pls help me to sort it out.

How to&Answers:

Hope this code will help you:

byte[] data = item1.getBytes();
Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
imageview.setImageBitmap(bmp);