If you want a progress bar to display while some work is being performed, you'll need to use another thread for the task, so it doesn't block the UI. That's the 'why' of this question; the progress dialog is blocked by the data download, so it doesn't get to display itself.
I'd go with AsyncTask from the Android API.
The following is a subclass from within the calling Activity:
private class myTask extends AsyncTask<Void, Void, Void> {
private ProgressDialog progDialog;
onPreExecute() {
progDailog = ProgressDialog.show(this, "Downloading data", "please wait....", true);
}
doInBackground(Void... params) {
// Here's where the work should happen
}
onPostExecute(Void result) {
// Close the dialog, pass results back, whatever...
}
}
Please excuse any code errors - I'm not where I can access the SDK.