Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I'm trying to convert byte[] into image. The byte[] comes from JSON and it's in this format:
- I'm using the following code convert byte[] to bitmap image.
- String encodedString="255,216,255,224,0,16,74,70,73,70,0,1,1,0,0,1,0,1,0....";
- byte[] encodeByte = encodedString.getBytes();
- System.out.println("encodeByte : "+encodeByte);
- System.out.println("encodeByte.length : "+encodeByte.length);
- Bitmap photo=BitmapFactory.decodeByteArray(encodeByte, 0, encodeByte.length);
- System.out.println("Bitmap photo : "+photo);
- btnImg.setImageBitmap(photo);
- I'm getting the following error in Logcat:
- 10-31 00:20:57.210: I/System.out(1315): encodeByte : [B@b3d249d8
- 10-31 00:20:57.210: I/System.out(1315): encodeByte.length : 18320
- 10-31 00:20:57.220: D/skia(1315): --- SkImageDecoder::Factory returned null
- 10-31 00:20:57.220: I/System.out(1315): Bitmap photo : null
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement