Your analysis is correct, up to the point where you say "so it can perhaps start a separate thread", where you get it exactly backwards.
It could start a new thread right then and there. Instead, you should say "so it can handle it IN THE SAME THREAD". The thread involved is called the UI thread. Your method is running on the UI thread. The dialog must also process events on the UI thread. Virtually every modern UI toolkit has this behavior. You NEVER wait in the UI thread -- doing so, hangs the UI. What you want to do is return, arranging to do something when the dialog completes. If this is a custom dialog, post an event when you click the 'OK' button, or whatever makes sense in your application. On Jul 18, 8:34 am, ecforu <[email protected]> wrote: > I have a dialog that I want to call from a method. However when I call > dlg.show(), in the method nothing happens. However the dialog does appear > when the method calling parent method completes. Why is this? > > It seems as though it is waiting for the parent thread to give up control, > so it can perhaps start a separate thread. If this is the case, is there a > way I can get the parent task to wait for the dialog to complete before > continuing on to the next instruction? > > private boolean CheckExit() > { > MyDialog dlg = new MyDialog(this); > dlg.show(); ==========> I want the dialog to show here > so i can get the results and return them > > return dlg.getResults(); > } =========================> Dialog doesn't show till this method exits -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

