title: How to pause an android app when a dialog box is being displayed?
body: <p>Hey I'm making a android app that is a simple webview. I want to redirect the user to browser on certain urls. I want to display a message in the form of a dialog box to alert the user that they are being redirected to their browser. The user will click OK and then the user is redirected.</p>
  
  <p>The following code is what I have. The problem is the app continues with the redirection without waiting for the user to click OK on the dialog box. I want to app to pause and continue any activity only if the user clicks OK.</p>
  
  <pre><code>            DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { /*DialogInterface called while setting the AlertDialog Buttons */
  
  
                  public void onClick(DialogInterface dialog, int which) {
  
                      //Here you can perform functions of Alert Dialog Buttons as shown
                      switch (which){
                          case DialogInterface.BUTTON_POSITIVE:
  
                              //I want the app to pause here.
                              //MainActivity.this.onPause(); does not work
                              break;
                      }
                  }
              };
  
              AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
              builder.setTitle("Title");// Set the Title of Alert Dialog
              builder.setMessage("We are taking you to the admin page.").setPositiveButton("OK",dialogClickListener).show();
  </code></pre>
  
  <p>Thanks, i prefer not using a wait() since I want my user to acknowledge what is happening by clicking a button</p>