Tuesday, 15 March 2011

networking - Android volley get callback when all requests finish -


I am using volley to line up a series of requests. When this request is being done, I am showing the progress dialog to the user. After completing all these requests, I can see that this is what I want. Show progress bar for

  // (int i = 0; i & lt; size; i ++) {// create request and request requestQueue.add (request); } / / When the last request finisses progres dismissed times   

There is a solution to this problem.

You can keep a total number of requests in a member variable:

 < Code> int pending request = 0; // ... for (int i = 0; i & lt; size; i ++) {requestQueue.add (request); PendingRequests ++; }   

Then every time a request reduces you to the counter, and if it reaches 0, then you know that all requests are made.

No comments:

Post a Comment