My phone APP downloads content perfectly in a text mode. Below is a code to do that. I call Communicator class and exectueHttpGet:
URL_Data = new Communicator(
What you receive is a series of characters from the InputStream
that you append to a StringBuffer
and convert to String
at the end - so the result of String
is ok :)
What you want is to post-process this String via org.json.*
classes like
String page = new Communicator().executeHttpGet("Some URL");
JSONObject jsonObject = new JSONObject(page);
and then work on jsonObject
. As the data you receive is an array, you can actually say
String page = new Communicator().executeHttpGet("Some URL");
JSONArray jsonArray = new JSONArray(page);
for (int i = 0 ; i < jsonArray.length(); i++ ) {
JSONObject entry = jsonArray.get(i);
// now get the data from each entry
}