title: How to add messagebox correctly in android
body: <p>I faced a syntax error with The method </p>
  
  <pre><code>setPositiveButton(String, new DialogInterface.OnClickListener(){}) : is undefined for the type AlertDialog
  </code></pre>
  
  <p>how to solve it ? </p>
  
  <hr>
  
  <pre><code>AlertDialog alertDialog = null;
  alertDialog = new AlertDialog.Builder(MainActivity.this).create();
  alertDialog.setTitle("error msg");
  alertDialog.setMessage("You should register before");
  alertDialog.setCancelable(true);
  alertDialog.setPositiveButton("Ok",
  new DialogInterface.OnClickListener() {
  public void onClick(DialogInterface dialog, int which) {
  //dismiss the dialog  
   }
  }); 
  
  alertDialog.show();
  </code></pre>
  
  <hr>