I hava an activity which might have to load data when it’s starting up.
I’ve read some other questions and they all involved passing the progressdialog to the asycntask (like this one which has to load the data and close it after it’s done. this is no option for my application since the method getNewData starts up 5 asynctasks and returns when they’re all done.
Anybody has an idea how i can make sure the progressdialog is shown? atm the screen just stays black until the application is done loading.
ProgressDialog pd = ProgressDialog.show(this, "Loading...", "Loading data", true);
dataCommunicator.getNewData(this);
pd.dismiss();
You may have a main
AsyncTaskinside which you can have the other threads running indoInBackground(). Show theprogressDialogin this mainAsyncTaskonPreExecute().Maintain an int variable which can be accessed across the child
AsyncTaskand update its value as the child completes its operations. When that int is equal to 5 return from the mainAsyncTaskdoInBackground()and dismiss theprogressDialoginonPostExecute().