The Thread instance has a join method, so:
private void onCreate() { final ProgressDialog dialog = ProgressDialog.show(this, "Please wait..", "Doing stuff..", true); Thread t = new Thread() { public void run() {
You might want to try:
private void onCreate() { final ProgressDialog dialog = ProgressDialog.show(this, "Please wait..", "Doing stuff..", true); Thread t = new Thread() { public void run() {
Since onCreate is in the user interface thread, having a connection there will freeze the user interface until onCreate completes, retaining any dialog before. stepTwo will have to use SwingUtilities.invokeLater to make any changes to the user interface.
source share