How to run AsyncTasks Sequentially
I have 3 AsyncTasks on my insert data activity.
The first one saves data to database. The second one uploads item's picture. The third one uploads the user's picture
When the user clicks the submit button, the first asynctask will run, and when its done, the second asynctask will run, and when its done the third asynctask will开发者_如何转开发 run.
When they're all finished, a toast will appear that says "Your data has been submitted"
How do you make asynctasks run sequentially like that?
The onPostExecute callback in AsyncTask is called from the UI thread, so you can start a new AsyncTask there for the next step.
精彩评论