Here is what I am trying to do.
From my Android App code I do an HTTP POST which is as below
HttpPost httppost = new HttpPost("http://xyz.com/Retrieve.php");
The PHP code is supposed to send back an image and an URL.
$q=mysql_query("SELECT image, url FROM testblob WHERE id = 'id[0]'");
list($data) = mysql_fetch_row($q);
echo $data;
Now in my Android code I do the following and the image is retrieved perfect from the response but how do I retrieve the URL as well.
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent();
I retrieve the image as below and this part works.
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
int n = 0;
while ((n=is.read(buf))>=0)
{
baos.write(buf, 0, n);
}
is.close();
byte[] bytes = baos.toByteArray();
Bitmap bitmap2 = null;
bitmap2 = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
So I would like to know if both the image and the url is received in the InputStream is object and if yes how do I retrieve the URL out of it?
Thanks for all the help.