I would like to ask how to get status code when using Volley.
I have following code:
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
// Here I want to get status code
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}
)
Is it possible ? If not, why ?
If you still want to use
StringRequest
, IMO, you can refer to the following sample code:Network response can be received in the following format
Maybe this class instead of StringResponse:
Usage:
It is not nice to use my own implementation instead of StringRequest. What do you think about it ?