11

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.

3
  • Can you attach the logcat error message?. Commented Jan 8, 2013 at 5:39
  • 1
    Corrected that plm with Bitmap bitmapimage = BitmapFactory.decodeByteArray(decrpt, 0, decrpt.length); Commented Jan 8, 2013 at 5:48
  • kindly write your answer down and close this question. Commented Jan 8, 2013 at 5:50

1 Answer 1

20

Hope this code will help you:

byte[] data = item1.getBytes();
Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
imageview.setImageBitmap(bmp);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.