code: private void showSystemUi(boolean show) {
          int flags = 0;
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
              flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                      | View.SYSTEM_UI_FLAG_FULLSCREEN
                      | View.SYSTEM_UI_FLAG_IMMERSIVE;
          }
  
          getWindow().getDecorView().setSystemUiVisibility(show ? 0 : flags);
      }
docs: Shows or hides system UI (status bar and navigation bar).