コード例 #1
0
 @Override
 public void onBackPressed() {
   if (mNavController.getCurrentStack().size() > 1) {
     mNavController.pop();
   } else {
     super.onBackPressed();
   }
 }
コード例 #2
0
  @Override
  protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    // Necessary to restore the BottomBar's state, otherwise we would
    // lose the current tab on orientation change.
    mBottomBar.onSaveInstanceState(outState);

    mNavController.onSaveInstanceState(outState);
  }
コード例 #3
0
 @Override
 public void pushFragment(Fragment fragment) {
   mNavController.push(fragment);
 }