title: How to perform onClick event in alertDialog?
body: <p>i created one exception class, inside declared Alert Dialog with OK button. Now i use this dialog in another class, this time when i click OK button it will redirect to another activity.</p>
  
  <pre><code>public class ExceptionClass {
  public static void showAlertDialog(Context context, String title, String message, Boolean status) {
      AlertDialog alertDialog = new AlertDialog.Builder(context).create();        
      alertDialog.setTitle(title);        
      alertDialog.setMessage(message);         
      alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
          }
      });       
      alertDialog.show();
  }}
  </code></pre>
  
  <p>Now i used this dialog in another class,like this</p>
  
  <pre><code> ExceptionClass.showAlertDialog(Activity2.class, "Title","error message" , true);
  </code></pre>
  
  <p>Now when i click OK button then it will redirect to Activity1.</p>