Question

Hey I need to display an image read from socket in my android application.The android application is basically a client it receives image from a java server.The java server writes a png file using ImageIO.write() function.I am new to android .Can somebody please help me

Was it helpful?

Solution

read the image first into byte[] array and then construct bitmap from bytes using BitmapFactory. It could look something like this:

byte[] buffer = new byte[imgSize];

//read all data to the buffer

BitmapFactory.decodeByteArray(buffer, 0, buffer.length);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top