title: IllegalArgumentException for ProgressDialog.dismiss() when it is showing
body: <p>Here is the simple code:</p>
  
  <pre><code>if (myProgressDialog.isShowing()) {
      myProgressDialog.dismiss();
  }
  </code></pre>
  
  <p>Could anyone shed some light on why myProgressDialog.dismiss() sometimes causes the following exception:</p>
  
  <pre><code>java.lang.IllegalArgumentException: View=com.android.internal.policy.PhoneWindow$DecorView{83559f5 V.E...... R......D 0,0-1026,348} not attached to window manager
  Stack trace: java.lang.IllegalArgumentException: View=com.android.internal.policy.PhoneWindow$DecorView{83559f5 V.E...... R......D 0,0-1026,348} not attached to window manager
          at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:424)
          at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:350)
          at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:116)
          at android.app.Dialog.dismissDialog(Dialog.java:362)
          at android.app.Dialog.dismiss(Dialog.java:345)
  </code></pre>