code: @Override
      public void onBackPressed() {
  
          // process back for fragment
          if (processBackPressed()) {
              return;
          }
  
          // process back for fragment
          boolean enableBackPressed = true;
          if (mCurrentFragment != null) {
              enableBackPressed = !mCurrentFragment.processBackPressed();
          }
          if (enableBackPressed) {
              int cnt = getSupportFragmentManager().getBackStackEntryCount();
              if (cnt <= 1 && isTaskRoot()) {
                  String closeWarningHint = getCloseWarning();
                  if (!mCloseWarned && !TextUtils.isEmpty(closeWarningHint)) {
                      Toast toast = Toast.makeText(this, closeWarningHint, Toast.LENGTH_SHORT);
                      toast.show();
                      mCloseWarned = true;
                  } else {
                      doReturnBack();
                  }
              } else {
                  mCloseWarned = false;
                  doReturnBack();
              }
          }
      }
docs: process back pressed