title: Android AlertDialog Builder
body: <p>I have an alertdialog that I show but no matter what I do the alertdialog shows with a blank Title and Message.
  The Icon, the Positive button and negative buttons show ok with correct descriptions.
  Here is the snippets of code that I use:
  In the Manifest file:</p>
  
  <pre><code>&lt;uses-sdk
  android:minSdkVersion="5"
  android:targetSdkVersion="16" /&gt;
  </code></pre>
  
  <p>In my code I declare:</p>
  
  <pre><code>import android.app.AlertDialog;
  import android.content.Context;
  import android.content.DialogInterface;
  </code></pre>
  
  <p>I also declare context:</p>
  
  <pre><code>final Context context = this;
  </code></pre>
  
  <p>I place my alert in :</p>
  
  <pre><code>public void confirm() {
  
      AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
  
          // set title
  
          alertDialogBuilder.setTitle("This is title");
          alertDialogBuilder.setIcon(R.drawable.ic_delete);
  
          // set dialog message
          alertDialogBuilder
          .setMessage("This is the message")
              .setCancelable(false)
              .setPositiveButton(R.string.yes,new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog,int id) {
                      // if this button is clicked, close
                      // current activity
                      MainActivity.this.finish();
                  }
                })
              .setNegativeButton(R.string.no,new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog,int id) {
                      // if this button is clicked, just close
                      // the dialog box and do nothing
                      dialog.cancel();
                  }
              });
  
              // create alert dialog
              AlertDialog alertDialog = alertDialogBuilder.create();
  
  
  
      // show it
              alertDialog.show();
  
  
  }
  </code></pre>
  
  <p>I then call confirm from where I need it, like so:</p>
  
  <pre><code>confirm();
  </code></pre>
  
  <p>The alert shows up ok. 
  The icon is set
  The setPositiveButton is good and contains correct description
  The setNegativeButton is good and contains correct description</p>
  
  <p>The Title is blank
  The Message is blank</p>
  
  <p>Any ideas?</p>