title: How to create a global alert dialog
body: <p>I want to make a "global" alert dialog for some of my activities. What i mean is that i created a class that extends <code>Activity</code> also created a function for the alert dialog that takes two parameters (message and title). </p>
  
  <pre><code>public class MyDialogAlert extends Activity {
  
  public void createDialog(String title, String message)
  {
      new AlertDialog.Builder(this)
      .setTitle(title)
      .setMessage(message)
      .setPositiveButton("yes", new OnClickListener() {
  
          @Override
          public void onClick(DialogInterface dialog, int which) {
              // TODO Auto-generated method stub
              //(e.g) open another activity
          }
      })
      .setNegativeButton("no", new OnClickListener() {
  
          @Override
          public void onClick(DialogInterface dialog, int which) {
              // TODO Auto-generated method stub
              //some stuff ..
          }
      })
      .show();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>How can i call this function in different activities and change it`s negative and positive buttons to do other operations than those defined initially in the above class?</p>
  
  <p>Thanks for the help :)</p>