Reputation: 265
i'm trying to send an image from a java server to an android device.
i can send the image from java server to java client using the ImageIO but since android doesn't support ImageIO i dont know how to receive the image from the java server.
I tried to convert the image to byte array then decode it on the android but it is not working probably and the byte array comes with a lot of problems size and length wise.
if anyone can point a correct way of sending an image and read it on an android device i would be very thankful.
edit ...
figured it out it is actually was simpler then i expected
client side load the image in a bufferedimage use ImageIO to write the image to the server stream
server side decode the stream into bitmap using bitmapFactory
Upvotes: 1
Views: 338
Reputation: 11122
My suggestion creating an API using PHP then with the API you can download the image in the byte form and after getting the byte array you can convert the byte to bitmap using this
Bitmap bitmap = BitmapFactory.decodeByteArray(bitmapdata , 0, bitmapdata .length);
Upvotes: 1