androidx.fragment.app.FragmentManager.popBackStackImmediate()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中androidx.fragment.app.FragmentManager.popBackStackImmediate()方法的一些代码示例,展示了FragmentManager.popBackStackImmediate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FragmentManager.popBackStackImmediate()方法的具体详情如下:
包路径:androidx.fragment.app.FragmentManager
类名称:FragmentManager
方法名:popBackStackImmediate

FragmentManager.popBackStackImmediate介绍

暂无

代码示例

代码示例来源:origin: westnordost/StreetComplete

@UiThread private void closeBottomSheet()
{
  // #285: This method may be called after the user tapped the home button from removeQuests().
  // At this point, it wouldn't be legal to pop the fragment back stack etc.
  // I am not entirely sure if checking for these things will solve #285 though
  // some more info here http://www.androiddesignpatterns.com/2013/08/fragment-transaction-commit-state-loss.html
  if(isDestroyed() || isFinishing() || isChangingConfigurations()) return;
  // manually close the keyboard before popping the fragment
  View view = this.getCurrentFocus();
  if (view != null)
  {
    InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    if(inputMethodManager != null)
    {
      inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }
  }
  getSupportFragmentManager().popBackStackImmediate(BOTTOM_SHEET, FragmentManager.POP_BACK_STACK_INCLUSIVE);
  mapFragment.setIsFollowingPosition(isFollowingPosition);
  mapFragment.setCompassMode(isCompassMode);
  mapFragment.removeQuestGeometry();
  mapFragment.showMapControls();
}

代码示例来源:origin: WireGuard/wireguard-android

@Override
  protected void onSelectedTunnelChanged(@Nullable final Tunnel oldTunnel,
                      @Nullable final Tunnel newTunnel) {
    final FragmentManager fragmentManager = getSupportFragmentManager();
    final int backStackEntries = fragmentManager.getBackStackEntryCount();
    if (newTunnel == null) {
      // Clear everything off the back stack (all editors and detail fragments).
      fragmentManager.popBackStackImmediate(0, FragmentManager.POP_BACK_STACK_INCLUSIVE);
      return;
    }
    if (backStackEntries == 2) {
      // Pop the editor off the back stack to reveal the detail fragment. Use the immediate
      // method to avoid the editor picking up the new tunnel while it is still visible.
      fragmentManager.popBackStackImmediate();
    } else if (backStackEntries == 0) {
      // Create and show a new detail fragment.
      fragmentManager.beginTransaction()
          .add(R.id.detail_container, new TunnelDetailFragment())
          .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
          .addToBackStack(null)
          .commit();
    }
  }
}

代码示例来源:origin: gateship-one/odyssey

fragmentManager.popBackStackImmediate("", FragmentManager.POP_BACK_STACK_INCLUSIVE);

相关文章