In my android application. I got binary code from a jpeg image from the code as follows.
byte[] val = stream.toByteArray();
BigInteger bi = new BigInteger(val);
String s = bi.toString(2);
This string s prints the binary value of the image. My question is how to convert this binary format into a jpeg image??
I've used this code in the past:
Hope this Helps
Edit: To write in Internal Memory
To write in External Memory
I'm not really sure what you want.
If you want to create a
Bitmap
-instance directly from the stream you can useBitmapFactory
and display thatBitmap
in anImageView
-instance afterwards:If you want to convert your string representation with radix 2 back to a binary array you can use
BigInteger
too: