I needs to make a call to a webservice for 5 times(as there are 5 different parameters) one by one or all at once. Once a particular call completed, in background a textview should be updated with text as: “1st completed”, “2nd Completed” and so on.
TextView value should be updated in background.
What should i do ? I am knowing the concept of AsyncTask, but i am confused that should i write 5 AsyncTask and then for each i write execute() method to execute the AsyncTask?
I am successful for only 1 one call, as i set “1st completed” in postExecute() method. But confused for the 5 times call.
Please suggest me a better way or exact solution.
You only need 1 AsyncTask, you have to do all 5 calls in the
doInBackground()and everytime you complete one call thepublishProgresspassing for example the number of the completed call, then, at the end do whatever you need inonPostExecute.A simple approach: