Pregunta

in my parseNetworkResponse method, sometimes I get an exception which should be caught and run return Response.error(new ParseError(e));

this happens, but ultimately my onErrorResponse method is never called, and I'm not sure how to branch logic to alter my views in case of an error, since my UI thread never gets to this case.

is anyone familiar with this issue (as opposed to me posting my entire class and trying to see if you can analyze this issue with just that)... perhaps there are some key classes I need to extend from Request

¿Fue útil?

Solución

the answer is that your extended Request class has to also implement deliverError, along with deliverResponse

private final Listener<T> mListener;
private ErrorListener mErrorListener;

@Override
 public void deliverError(VolleyError error) {
    mErrorListener.onErrorResponse(error);
}

with ErrorListener initialized in your constructor

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top