As the user types, I need to fire off three requests in parallel to fetch the data for the list that is displayed for AutoCompleteTextView dropdown. I understand that performFiltering is done on a thread. Should this method spawn off 3 more AsyncTasks or threads ? Or is there any other way ?
            Asked
            
        
        
            Active
            
        
            Viewed 60 times
        
    0
            
            
        - 
                    see [this](https://stackoverflow.com/a/19860624/2252830) - here one call to web api is done - you can call your three requests in the same thread or in their own three threads and wait for their completion by using `join` method – pskink Aug 24 '17 at 17:51
 
1 Answers
0
            
            
        You dont need to use Asynctasks or Threads. Simply call 3 requests using Volley or Retrofit. Those are asynchronous. And maintain 3 boolean variables for 3 requests. Initially values of 3 variables are false. when requests receives the result make relevant variable true and check whether all 3 variables are true. if so all 3 results are came otherwise not. so if all 3 true you can show the results in dropdown. If you want user to wait till result coming, display a loading icon or a progressbar and when all 3 requests completed hide that loader
        thinuwan
        
- 631
 - 2
 - 8
 - 20