protected void showAlertDialogAndFinish(String title, String message) {
    interrupt();
    stopRepeating();

    new AlertDialog.Builder(AccessibilityTutorialActivity.this)
        .setTitle(title)
        .setMessage(message)
        .setCancelable(true)
        .setOnCancelListener(mFinishActivityOnCancelListener)
        .setPositiveButton(
            R.string.accessibility_tutorial_alert_dialog_exit, mFinishActivityOnClickListener)
        .create()
        .show();
  }
  private void show(int which) {
    if ((which < 0) || (which >= mViewAnimator.getChildCount())) {
      LogUtils.log(this, Log.WARN, "Tried to show a module with an index out of bounds.");
      return;
    }

    if (which != mViewAnimator.getDisplayedChild()) {
      // Interrupt speech and stop the previous module.
      mAccessibilityManager.interrupt();
      interrupt();
      stopRepeating();
      mViewAnimator.setOnKeyListener(null);
      getCurrentModule().onPause();
      getCurrentModule().onStop();
    }

    mViewAnimator.setDisplayedChild(which);
  }
  @Override
  protected void onPause() {
    super.onPause();
    sTutorialIsActive = false;

    final TalkBackService service = TalkBackService.getInstance();
    if (service != null) {
      service.removeServiceStateListener(mServiceStateListener);
    }

    getCurrentModule().onPause();

    interrupt();

    // This is different than stopRepeating because we want the current
    // instruction text to continue repeating if the activity resumes.
    mRepeatHandler.removeMessages(RepeatHandler.MSG_REPEAT);

    unlockOrientation();
  }