A
A
afna2015-08-13 16:07:15
Java
afna, 2015-08-13 16:07:15

How to get response status using Volley library?

Hello!
In my application I use the Volley library.
I make a request to receive a string response:

StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        // do something
                    }
                },
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        // do something
                    }
                });

Can you please tell me how can I get the response code?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
one pavel, 2015-08-13
@sulik93

The NetworkResponse object has a statusCode that is returned by the server

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question