As the title states, Im using httpget in android, and its working. However, it's returning incomplete data. the call is returning roughly 99kb of json data. However, My function is only producing 38kb and the json string is incomplete.
I'm not getting any errors at all, so it's hard to see why its happening.
size measurements are just me making the call in the browser and saving the output to a file, and doing the same with the output from the function.
here's the code that gets the url:
public String getpage2(){
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(this.request);
HttpResponse response = null;
try {
response = client.execute(request);
} catch (ClientProtocolException e2) {
// TODO Auto-generated catch block
Log.e("getpage",e2.toString());
e2.printStackTrace();
} catch (IOException e2) {
// TODO Auto-generated catch block
Log.e("getpage",e2.toString());
e2.printStackTrace();
}
String html = "";
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "UTF-8"));
StringBuilder builder = new StringBuilder();
for (String line = null; (line = reader.readLine()) != null ; ) {
builder.append(line).append("\n");
}
html = builder.toString();
Log.d("nr",builder.capacity() + "/" + builder.length());
} catch (IOException e) {
// TODO Auto-generated catch block
Log.e("getpage",e.toString());
e.printStackTrace();
}finally{
}
return html;
}
any help would be appreciated. I'm at a loss...