Good time of day. I want to make so that the image received by the tcp protocol in the form of an array of bytes can be displayed, say, in the ImageView android. Could you please give me a little idea, or give a link to good material on this topic?

  • one
    TCP is a transport protocol that only guarantees packet transmission. The application level protocol runs on top of it - it is unclear what you want to use for this. - nzeemin

1 answer 1

To unpack the image contained in the array:

byte[] data = ... 

In Android:

 Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length); imageview.setImageBitmap(bmp); 

In JavaSE:

 BufferedImage img = ImageIO.read(new ByteArrayInputStream(data)); ... 
  • Thank you so much, I will try - Kostya Maltsev