I’ve been working on a web-based android app , and we want the app to post data to server and read the response as JSONString , the code was tested on 3 different devices and all result ok , except for Droid X , it just hangs up on reading the inputStream from HttpResponse.
Here is my code :
HttpResponse response = mClient.execute(mPost);
StatusLine status_line = response.getStatusLine();
int status_code = status_line.getStatusCode();
/*
* Not ok Response
*/
if (status_code != 200){
mBusy = false;
mListener.log("Error Status code = "+String.valueOf(status_code));
return false;
}
HttpEntity entry = response.getEntity();
BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "UTF-8"));
mResponse = reader.readLine();
Any ideas what should I do ?
I found out that the problem source was using android’s default HTTP Client.
instead I used :
instead of :
hope that helps someone.