title: Android - why would Dialog not close upon dialog.dismiss()
body: <p>I have a bit of a strange problem.  When an activity starts, I show a dialog saying that some items are loading like this:</p>
  
  <pre><code>Dialog dialog;
  
  @Override
  public void onCreate(Bundle savedInstanceState) 
  {
      super.onCreate(savedInstanceState);        
      setContentView(R.layout.topic_edit);
  
      dialog = new Dialog (this);
  
      dialog.setContentView(R.layout.please_wait);
      dialog.setTitle("Loading The Comment.");
  
      TextView text = (TextView) dialog.findViewById(R.id.please_wait_text);
      text.setText("Please wait while the comment loads...");
      dialog.show();
  </code></pre>
  
  <p>I declare Dialog dialog right before the class declaration, and then whenever I try to dismiss it with <code>dialog.dismiss();</code> it doesn't close.</p>
  
  <p>Here is the please_wait.xml </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" &gt;
  
  &lt;TextView
      android:id="@+id/please_wait_text"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"/&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Would someone know why the dialog does not close on <code>dialog.dismiss()</code>... I try the dismiss in an async call after the call returns. But I did check, and the line <code>dialog.dismiss()</code> is executed, just for some reason does not close the dialog.</p>
  
  <p>This is how I try to dismiss the dialog:</p>
  
  <pre><code>@Override
  protected void onPostExecute(String result) 
  {
      dialog.dismiss();
  } 
  </code></pre>