Handle single progressdialog with parallel multiple asynctask
android, android-asynctask, progressdialog
Solution
There are different ways to handle this situation.
You can use a counter variable initialized with the number of tasks, and this counter gets decremented when an `AsyncTask` is complete. When the counter is 0, the `ProgressDialog` is dismissed. You can do this decrement and checking for progress dialog dismissal in each of the `AysncTask`'s `onPostExecute`.
You may not need the 3 different `AsyncTask`s. You can use a single `AsyncTask` with a `CountDownLatch` for `Thread` synchronization.
Problem
In my Project I want to parallelly load the data from 3 different url's(webservice) while loading the page. for this I use 3 different asynctask to load data. I want to show the progress dialog message as "loading" when first asynctask is started and close dialog after last asynctask is completed(until complete 3 tasks show progress dialog). Please tell me the way to handle this situation.