I have a ByteArrayOutputStream I have created using the QRGen Qr code generation library
, and I want to turn it into a BufferedImage
object and present it in an ImageView in Android. How may that be achieved?
Asked
Active
Viewed 2,359 times
3

StackExchange User
- 1,222
- 14
- 35

Iddo Gino
- 342
- 2
- 11
1 Answers
0
Convert the ByteArrayOutputStream to Byte array
byte[] data = baos.toByteArray(); //baos is your ByteArrayOutputStream object
them create a bitmap out of it using the BitmapFactory
Bitmap bmp = BitmapFactory.decodeByteArray (data,0,data.length, null);
them take your ImageView and set its bitmap
imageView.setImageBitmap(bmp);

Iddo Gino
- 342
- 2
- 11

Kirill Kulakov
- 10,035
- 9
- 50
- 67