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

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

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

FragmentManager.putFragment介绍

暂无

代码示例

代码示例来源:origin: pranavpandey/dynamic-support

@Override
public Parcelable saveState() {
  Parcelable p = super.saveState();
  Bundle bundle = new Bundle();
  bundle.putParcelable(ADS_FRAGMENT_STATE_SUPER_STATE, p);
  bundle.putInt(ADS_FRAGMENT_STATE_PAGES, mPages.size());
  if (0 < mPages.size()) {
    for (int i = 0; i < mPages.size(); i++) {
      int position = mPages.keyAt(i);
      bundle.putInt(createCacheIndex(i), position);
      Fragment f = mPages.get(position);
      mFragmentManager.putFragment(bundle, createCacheKey(position), f);
    }
  }
  return bundle;
}

代码示例来源:origin: jruesga/rview

@Override
protected void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  outState.putParcelable(getClass().getSimpleName() + "_model", mModel);
  //Save the fragment's instance
  Fragment fragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG_LIST);
  if (fragment != null) {
    getSupportFragmentManager().putFragment(outState, FRAGMENT_TAG_LIST, fragment);
  }
  fragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG_DETAILS);
  if (fragment != null) {
    getSupportFragmentManager().putFragment(outState, FRAGMENT_TAG_DETAILS, fragment);
  }
}

代码示例来源:origin: jruesga/rview

@Override
protected void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  outState.putInt(EXTRA_SELECTED_ITEM, mSelectedChangeId);
  //Save the fragment's instance
  Fragment fragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG_LIST);
  if (fragment != null) {
    getSupportFragmentManager().putFragment(outState, FRAGMENT_TAG_LIST, fragment);
  }
  fragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG_DETAILS);
  if (fragment != null) {
    getSupportFragmentManager().putFragment(outState, FRAGMENT_TAG_DETAILS, fragment);
  }
}

代码示例来源:origin: jruesga/rview

@Override
protected void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  outState.putInt(EXTRA_SELECTED_ITEM, mSelectedChangeId);
  //Save the fragment's instance
  Fragment fragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG_LIST);
  if (fragment != null) {
    getSupportFragmentManager().putFragment(outState, FRAGMENT_TAG_LIST, fragment);
  }
  fragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG_DETAILS);
  if (fragment != null) {
    getSupportFragmentManager().putFragment(outState, FRAGMENT_TAG_DETAILS, fragment);
  }
}

代码示例来源:origin: AlexMofer/ProjectX

@Override
public Parcelable saveState() {
  Bundle state = null;
  if (mSavedState.size() > 0) {
    state = new Bundle();
    Fragment.SavedState[] fss = new Fragment.SavedState[mSavedState.size()];
    mSavedState.toArray(fss);
    state.putParcelableArray("states", fss);
  }
  final int count = getCount();
  for (int position = 0; position < count; position++) {
    final long itemId = getItemId(position);
    String name = makeFragmentName(mViewGroupId, itemId);
    Fragment fragment = mFragmentManager.findFragmentByTag(name);
    if (fragment != null && fragment.isAdded()) {
      if (state == null) {
        state = new Bundle();
      }
      String key = "f" + itemId;
      mFragmentManager.putFragment(state, key, fragment);
    }
  }
  return state;
}

代码示例来源:origin: jruesga/rview

@Override
protected void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  //Save the fragment's instance
  Fragment fragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG);
  if (fragment != null) {
    getSupportFragmentManager().putFragment(outState, FRAGMENT_TAG_LIST, fragment);
  }
}

代码示例来源:origin: jruesga/rview

@Override
protected void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  //Save the fragment's instance
  Fragment fragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG);
  if (fragment != null) {
    getSupportFragmentManager().putFragment(outState, FRAGMENT_TAG, fragment);
  }
}

代码示例来源:origin: jruesga/rview

@Override
protected void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  //Save the fragment's instance
  Fragment fragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG);
  if (fragment != null) {
    getSupportFragmentManager().putFragment(outState, FRAGMENT_TAG, fragment);
  }
}

代码示例来源:origin: jruesga/rview

@Override
protected void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  //Save the fragment's instance
  Fragment fragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG);
  if (fragment != null) {
    getSupportFragmentManager().putFragment(outState, FRAGMENT_TAG, fragment);
  }
}

代码示例来源:origin: jruesga/rview

@Override
protected void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  //Save the fragment's instance
  Fragment fragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG);
  if (fragment != null) {
    getSupportFragmentManager().putFragment(outState, FRAGMENT_TAG, fragment);
  }
}

代码示例来源:origin: searchy2/CustomPermissionsDialogue

@Override
protected void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  if (getSupportFragmentManager().findFragmentByTag("currentFragment") != null)
  {
    fragment =  getSupportFragmentManager().findFragmentByTag("currentFragment");
    getSupportFragmentManager().putFragment(outState, "currentFragment", fragment);
  }
}

相关文章