Android Client send a request to the server.
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://test.com/test");
HttpResponse response = httpclient.execute(httppost);
and then received response from server like below
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Date: Wed, 26 Sep 2012 10:59:35 GMT
Content-Type: multipart/form-data; type="image/jpeg"; boundary="simple_boundary"; start="<image>"; start-info="image/jpeg"
Transfer-Encoding: chunked
2000
--simple_boundary
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
Content-ID: <image>
......JPEG Binary Code Here.....
--simple_boundary
How can I get the Image(binary) from the response.
InputStream is = response.getEntity().getContent();
(InputStream)is contains boundary and content information also.
--simple_boundary
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
Content-ID: <image>
......JPEG Binary Code Here.....
--simple_boundary
How can I get pure Image binary data. And it's possible??
Bitmap bitmap = BitmapFactory.decodeStream((InputStream) response.getEntity().getContent());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With