I want to send an Image (.png or .jpg, I tried both) with an Socket Connection from a server to an Android phone.
I convert the Buffered Image to a byte array via:
The server has no problems with decoding it again. I suspected that the following would be enough to convert the Byte Array back to an image on the phone:
But unfortunately the BitmapFactory returns null, indicading that the byte array could not be decoded.
I'm clueless here, I suspect the decoding to be the problem here, but of course it could also be the socket connection.
That's why I wanted to ask, if someone can confirm that a byte array produced by ImageIO/ByteArrayOutputStream can be decoded with BitmapFactory.decodeByteArray or if someone knows a better way of doing this.
Thx in advance