My program does some network activity in a background thread. Before starting, it pops up a progress dialog. The dialog is dismissed on the handler. This all works fine, exc
I faced this same problem, and I came up with a solution that didn't invole using the ProgressDialog and I get faster results.
What I did was create a layout that has a ProgressBar in it.
Then in the onCreate method do the following
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.progress);
}
Then do the long task in a thread, and when that's finished have a Runnable set the content view to the real layout you want to use for this activity.
For example:
mHandler.post(new Runnable(){
public void run() {
setContentView(R.layout.my_layout);
}
});
This is what I did, and I've found that it runs faster than showing the ProgressDialog and it's less intrusive and has a better look in my opinion.
However, if you're wanting to use the ProgressDialog, then this answer isn't for you.