I am trying to get the response code for the HttpReponse. There is no method for get the response code directly.
HttpResponse.getStatusLine().getStatusCode() is what you are looking for.
Please find the link Android: How get the status-code of an HttpClient request
Hopefully, it will help you.
Regards,
Android Geek.
This is how you get Response code if you are using HttpUrlConnection
:
int status = ((HttpURLConnection) connection).getResponseCode();
Log.i("", "Status : " + status);
And here is if you are using HttpClient
:
HttpResponse response = httpclient.execute(httppost);
Log.w("Response ","Status line : "+ response.getStatusLine().toString());
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