본문 바로가기

프로그래밍 일반/안드로이드 심화

[안드로이드] Volley사용시 NetworkResponseError 제대로 잡기

                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {

                        NetworkResponse networkResponse = error.networkResponse;
                        if (networkResponse != null && networkResponse.data != null) {
                            String jsonError = new String(networkResponse.data);
                            Log.d(TAG, "onErrorResponse: " + jsonError);
                        }

                    }
                }

 

참조 문서 :

 

https://stackoverflow.com/questions/42038626/how-to-get-json-error-response-in-volley-onerrorresponse/42039254

 

How to get JSON error response in Volley onErrorResponse

I have an API call with below details URL: http://pankajservers.in/api/v1/AuthenticateUser with Input params below EmailAddress and Password if I type wrong credentials, I get below JSON

stackoverflow.com