Is Dialog.show() a non-blocking method?
<p>I've got a button that kicks off a background thread to do some work and I am trying to use a ProgressDialog to prevent the user from double clicking that button (or any other ui elements) while that work is being done.  The first thing I do in my buttons onClick code is to display the progress dialog, which takes over the screen.  The problem I am seeing is that if I rapidly tap this button, sometimes two or more presses will register before the ProgressDialog is shown.  This leads me to assume that ProgressDialog.show() is returning before the ProgressDialog is actually visible.</p>

<p>Can anybody confirm this?  Also, is there a way to change this behavior, or at least get a notification of when the dialog is actually visible?  I saw Dialog.onStart() but given the javadoc, this appears to be called before the Dialog is actually visible...</p>

<p>UPDATE:
While it appears that there is no good way of solving this problem in general, the following works for my situation where my work is done by an external thread and the amount of work to do takes longer than the time it takes for all the button clicks to be processed:</p>

<pre><code>void myOnClickHandler() {
  if(myButton.isEnabled()) {
    myButton.setEnabled(False);
    // do work here
    // setEnabled(true) is invoked at the end of my spawned thread's run().
  }
}
</code></pre>
