title: Android: Passing parameters to Alert Dialog
body: <p>I am showing a simple Alert Dialog with OK/Cancel buttons.
  When user clicks OK, some code runs - that needs a parameter.</p>
  
  <pre><code>AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
          MainActivity.this);
          alertDialogBuilder
          .setTitle("Are you sure?")
          .setCancelable(false)
          .setPositiveButton("OK", new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int id) {
                  //TODO: Do something with parameter.
              }
          })
          .setNegativeButton("Cancel",
                  new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int id) {
                          dialog.cancel();
  
                      }
                  });
  
  // create alert dialog
  AlertDialog alertDialog = alertDialogBuilder.create();
  
  // show it
  alertDialog.show();
  </code></pre>
  
  <p><strong>How do i pass the parameter to AlertDialog?</strong></p>