I understand how varargs work and the java mechanics for using them within the doInBackground() method of AsyncTask. However, I'm not clear about why varargs are used here and under what circumstances there will be more than one argument passed to this method.
I have some specific questions: 1. Is it the case that if execute() is called multiple times before all of the background tasks have completed, then it is possible that doInBackground() might be called with more than one argument; i.e., one for each execute() call that is currently being processed? 2. If I am iterating through multiple varargs items in doInBackground(), can I count on the fact that this method will not be interrupted by other doInBackground() calls for other execute() invocations that might be made against the same AsyncTask object? 3. If there are multiple arguments being passed to doInBackground(), at what point will onPostExecute() get called? I presume it's some time after this particular call to doInBackground() completes processing all of its varargs arguments, correct? 4. Consider this timeline? (can it even occur?) ... A. execute() gets called on a given AsyncTask object. B. execute() gets called on the same AsyncTask object. C. execute() gets called on the same AsyncTask object D. The runtime system calls doInBackground(), passing it varargs that correspond to each of the A, B, and C calls. E. While the doInBackground() call in step D is running, excute() gets called on the same AsyncTask object. F. While the doInBackground() call in step D is running, excute() gets called on the same AsyncTask object. G. The runtime system calls doInBackground(), passing it varargs that correspond to the E and F calls. In this scenario, how many times will onPostExecute() get called? Once for each execute() call, or once for each doInBackground() call? ... or what? Thanks for helping me to understand this. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

