I have an android app where I am doing the following:
private void onCreate() {
final ProgressDialog dialog = ProgressDialog.show(this, "Please wait..", "Doing stuff..", true);
new Thread() {
public void run() {
//do some serious stuff...
dialog.dismiss();
}
}.start();
stepTwo();
}
And I would like to ensure that my thread is complete before stepTwo(); is called. How can I do this?
Thanks!
The Thread instance has a join method, so:
You may want to try this though:
Because onCreate is in the UI thread, having the join in there will freeze the UI till after onCreate completes, saving any dialog till then.
stepTwowill have to useSwingUtilities.invokeLaterto do any UI changes itself.