I am fetching Image and Text for GridView from a webservice, so its takes some time to display the GridView. I want to show a ProgressDialog till Grid gets fully loaded. Wha
This should be your inner AsyncTask class, change parameters as you need.
private class yourTask extends AsyncTask {
String message;
ProgressDialog dialog;
public refreshTask(String message) {
this.message = message;
this.dialog = new ProgressDialog(PCGridMain.this);
}
@Override
protected void onPreExecute() {
dialog.setMessage(message);
dialog.setIndeterminate(true);
dialog.setCancelable(true);
dialog.show();
}
@Override
protected ArrayList doInBackground(String... params) {
// Some work
}
@Override
protected void onPostExecute(ArrayList result) {
if(dialog.isShowing())
dialog.dismiss();
}
}
So you may call this class like:
new yourTask('Dialog message').execute();
I hope it solves your issue.