@Override
 public void onClick(DialogInterface dialogInterface, int button) {
   if (button == WifiDialog.BUTTON_FORGET && mSelectedAccessPoint != null) {
     forget();
   } else if (button == WifiDialog.BUTTON_SUBMIT) {
     if (mDialog != null) {
       submit(mDialog.getController());
     }
   }
 }
  @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);
      }
    }
  }