Reputation: 135
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?
Upvotes: 2
Views: 3075
Reputation: 39894
The onPostExecute callback in AsyncTask is called from the UI thread, so you can start a new AsyncTask there for the next step.
Upvotes: 6