It seems simple to me if I am not mistaken in the problem. Why don't you start showing your progress bar (preferably indefinite), and when your requests succeed or fail, you just stop the progress bar.
Something like that: -
myRequest(){ //Start Showing your progress bar here showProgressBar(); JsonObjectRequest myRequest = new JsonObjectRequest(Request.Method.GET, URL, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { //Hide progress bar here hideProgressDialog(); //TODO: I forgot what to do } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { //Hide progress bar here hideProgressDialog(); } }); queue.add(myRequest); }
Hope this helps :)
source share