I have to do something after the request finish. like dismiss a loading dialog
I have to add dialog.dismiss();
in every request for both onResponse() and onErrorResponse().
Do volley have global callback? I want to have global callback in same fragment/activity to handle error/successful message
JsonRequest jsonRequest = new JsonRequest
(url, params, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
dialog.dismiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
dialog.dismiss();
}
}) {
};
Yes you can do this by creating custom volley request. See the code below :
Let me know if this works. :)