Android Volley - Waiting for multiple responses to complete and then do something -


so basically, send 3 requests using volley retrieve data database. because i'm using different adapters instances display each set of data. send them in order

  1. request1
  2. request2
  3. request3

i have put code inside onresponse() method of response3 processes data retrieved previous requests too. need wait all responses finish before processing.

here lies problem though. there times request3 has least data retrieve, finishing faster others. responses this:

  1. response3. here code processes data response1 , response2 executes before 2 have finished, getting wrong results.
  2. response1
  3. response2

if there way wait all responses finish, can put processing code in method. don't know how that. ideas?

simply write 2 methods:

executesecondrequeset() has response2

executethirdrequeset() has response3

and inside onresponse() of first request call executesecondrequeset() declared , in onresponse() of call executethirdrequeset() method :)


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -