I assume you want a modal dialog. I'm pretty sure blocking the UI thread is going about this wrong. For example, consider the Activity lifecycle callbacks which would be called when another Activity or Application becomes visible.
Here's an explanation I found by googling for android modal dialog: http://groups.google.com/group/android-developers/browse_thread/thread/5616a220c97a13fc/5e722e601f33d884#5e722e601f33d884 On Tue, Dec 29, 2009 at 3:52 AM, swapnil kamble <[email protected]>wrote: > Hi , > I am displaying Confirmation type dialog box. I want to pause > execution of that thread until answer is provided by user, but since this > AlertDialog works asynchronously, I am facing problems in blocking that > thread but displaying AlertDialog and continue execution on answer. I tried > using wait notify between threads but didn't worked. Anybody Used > AlertDialog.wait() method ? > I am pasting my code here too, > > AlertDialog.Builder builder = new > AlertDialog.Builder(Demo.ctxt); > > builder.setMessage("Do you want to Trust testgenservercert") > .setCancelable(false) > > .setPositiveButton("Yes", new DialogInterface.OnClickListener() { > public void > onClick(DialogInterface dialog, int id) { > > > //uiThread.notify(); > > System.out.println("Positive Button clicked"); > } > }) > > .setNegativeButton("No", new DialogInterface.OnClickListener() { > public void > onClick(DialogInterface dialog, int id) { > > > //uiThread.notify(); > > > System.out.println("Negative Button clicked"); > > } > }); > /*uiThread = > Thread.currentThread(); > AlertDialog alert = > builder.create(); > alert.show(); > synchronized(alert) { > alert.wait(); > }*/ > > > -- > ...Swapnil > > || Hare Krishna Hare Krishna Krishna Krishna Hare Hare || > || Hare Rama Hare Rama Rama Rama Hare Hare || > > -- > 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]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- 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

