I want to handle and show some message in onErrorResponse
below is my code.
String url = MainActivity.strHostUrl+"api/delete_picture";
jobjDeleteImage = new JsonObjectRequest(Request.Method.POST, url, jobj, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.e("Image response", response.toString());
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("Volly Error", error.toString());
NetworkResponse networkResponse = error.networkResponse;
if (networkResponse != null) {
Log.e("Status code", String.valueOf(networkResponse.statusCode));
}
}
});
I want to handle com.android.volley.TimeoutError
and also some other error code like 404, 503 etc and Toast
message here.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…