android.support.v4.app.Fragment.isInBackStack()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(122)

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

Fragment.isInBackStack介绍

暂无

代码示例

代码示例来源:origin: sockeqwe/mosby

/**
 * Checks whether or not a given fragment is on the backstack of the fragment manager (could also
 * be on top of the backstack and hence visible)
 *
 * @param fragment The fragment you want to check if its on the back stack
 * @return true, if the given Fragment is on the back stack, otherwise false (not on the back
 * stack)
 */
public static boolean isFragmentOnBackStack(Fragment fragment) {
  try {
    return fragment.isInBackStack();
  } catch (IllegalAccessError e) {
    return isInBackStackAndroidX(fragment);
  }
}

代码示例来源:origin: grandcentrix/ThirtyInch

/**
 * Checks whether or not a given fragment is on the backstack of the fragment manager (could
 * also be on top of the backstack and hence visible)
 *
 * @param fragment The fragment you want to check if its on the back stack
 * @return true, if the given Fragment is on the back stack, otherwise false (not on the back
 * stack)
 */
public static boolean isInBackStack(final Fragment fragment) {
  try {
    return fragment.isInBackStack();
  } catch (IllegalAccessError e) {
    return isInBackStackAndroidX(fragment);
  }
}

代码示例来源:origin: stackoverflow.com

public void removeFragment(Fragment fragment, int transition, int transitionStyle) {
  if (DEBUG) Log.v(TAG, "remove: " + fragment + " nesting=" + fragment.mBackStackNesting);
  final boolean inactive = !fragment.isInBackStack();
  if (!fragment.mDetached || inactive) {
    if (mAdded != null) {
      mAdded.remove(fragment);
    }
    if (fragment.mHasMenu && fragment.mMenuVisible) {
      mNeedMenuInvalidate = true;
    }
    fragment.mAdded = false;
    fragment.mRemoving = true;
    moveToState(fragment, inactive ? Fragment.INITIALIZING : Fragment.CREATED,
        transition, transitionStyle, false);
  }
}

代码示例来源:origin: com.google.android/support-v4

public void removeFragment(Fragment fragment, int transition, int transitionStyle) {
  if (DEBUG) Log.v(TAG, "remove: " + fragment + " nesting=" + fragment.mBackStackNesting);
  final boolean inactive = !fragment.isInBackStack();
  if (!fragment.mDetached || inactive) {
    mAdded.remove(fragment);
    if (fragment.mHasMenu && fragment.mMenuVisible) {
      mNeedMenuInvalidate = true;
    }
    fragment.mAdded = false;
    fragment.mRemoving = true;
    moveToState(fragment, inactive ? Fragment.INITIALIZING : Fragment.CREATED,
        transition, transitionStyle);
  }
}

代码示例来源:origin: kingargyle/adt-leanback-support

public void removeFragment(Fragment fragment, int transition, int transitionStyle) {
  if (DEBUG) Log.v(TAG, "remove: " + fragment + " nesting=" + fragment.mBackStackNesting);
  final boolean inactive = !fragment.isInBackStack();
  if (!fragment.mDetached || inactive) {
    if (mAdded != null) {
      mAdded.remove(fragment);
    }
    if (fragment.mHasMenu && fragment.mMenuVisible) {
      mNeedMenuInvalidate = true;
    }
    fragment.mAdded = false;
    fragment.mRemoving = true;
    moveToState(fragment, inactive ? Fragment.INITIALIZING : Fragment.CREATED,
        transition, transitionStyle, false);
  }
}

相关文章

微信公众号

最新文章

更多

Fragment类方法