Get HTTP status code for successful requests with Volley

前端 未结 4 1331
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-28 16:03

I\'m retrieving the content of a invalid web address with volley, i.e. http://www.gigd32fdsu.com: This is my test code:

// Instantiate the Reque         


        
4条回答
  •  我在风中等你
    2020-12-28 16:31

    Just override the parseNetworkResponse method then take the statusCode value.

    public class StrImplRequest extends StringRequest {
        @Override
        protected Response parseNetworkResponse(NetworkResponse response) {
            // take the statusCode here.
            response.statusCode;
            return super.parseNetworkResponse(response);
        }
    }
    

提交回复
热议问题