@Override
  public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    // If the dialog is showing, save its state.
    if (mDialog != null && mDialog.isShowing()) {
      outState.putBoolean(SAVE_DIALOG_EDIT_MODE, mDlgEdit);
      if (mDlgAccessPoint != null) {
        mAccessPointSavedState = new Bundle();
        mDlgAccessPoint.saveWifiState(mAccessPointSavedState);
        outState.putBundle(SAVE_DIALOG_ACCESS_POINT_STATE, mAccessPointSavedState);
      }
    }
  }