This question already has an answer here:
- Android: How get the status-code of an HttpClient request 2 answers
I am trying to get the response code for the HttpReponse. There is no method for get the response code directly.
This question already has an answer here:
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());