Example usage for android.app Fragment isInBackStack

List of usage examples for android.app Fragment isInBackStack

Introduction

In this page you can find the example usage for android.app Fragment isInBackStack.

Prototype

final boolean isInBackStack() 

Source Link

Usage

From source file:android.app.FragmentManager.java

public void removeFragment(Fragment fragment, int transition, int transitionStyle) {
    if (DEBUG)/*  w  w w. j av a  2s.com*/
        Log.v(TAG, "remove: " + fragment + " nesting=" + fragment.mBackStackNesting);
    final boolean inactive = !fragment.isInBackStack();
    if (!fragment.mDetached || inactive) {
        if (false) {
            // Would be nice to catch a bad remove here, but we need
            // time to test this to make sure we aren't crashes cases
            // where it is not a problem.
            if (!mAdded.contains(fragment)) {
                throw new IllegalStateException("Fragment not added: " + fragment);
            }
        }
        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);
    }
}