public abstract class FragmentManager implements FragmentResultOwner

Static library support version of the framework's Used to write apps that run on platforms prior to Android 3.0. When running on Android 3.0 or above, this implementation is still used; it does not try to switch to the framework's implementation. See the framework FragmentManager documentation for a class overview.

Your activity must derive from FragmentActivity to use this. From such an activity, you can acquire the FragmentManager by calling getSupportFragmentManager.


Nested types


Representation of an entry on the fragment back stack, as created with FragmentTransaction.addToBackStack().


Callback interface for listening to fragment state changes that happen within a given FragmentManager.


Interface to watch for changes to the back stack.


static final int

Flag for popBackStack and popBackStack: If set, and the name or ID of a back stack entry has been supplied, then all matching entries will be consumed until one that doesn't match is found or the bottom of the stack is reached.

Public constructors

Public methods


Add a FragmentOnAttachListener that should receive a call to onAttachFragment when a new Fragment is attached to this FragmentManager.


Add a new listener for changes to the fragment back stack.

@NonNull FragmentTransaction

Start a series of edit operations on the Fragments associated with this FragmentManager.


Clears the back stack previously saved via saveBackStack.

final @Override void

Clears the stored result for the given requestKey.

final @Override void

Clears the stored FragmentResultListener for the given requestKey.

    @NonNull String prefix,
    @Nullable FileDescriptor fd,
    @NonNull PrintWriter writer,
    String[] args

Print the FragmentManager's state into the given stream.

static void
enableDebugLogging(boolean enabled)

This method is deprecated.

FragmentManager now respects isLoggable for debug logging, allowing you to use adb shell setprop log.tag.FragmentManager VERBOSE.


After a FragmentTransaction is committed with FragmentTransaction.commit(), it is scheduled to be executed asynchronously on the process's main thread.

static @NonNull F
<F extends Fragment> findFragment(@NonNull View view)

Find a Fragment associated with the given View.

@Nullable Fragment

Finds a fragment that was identified by the given id either when inflated from XML or as the container ID when added in a transaction.

@Nullable Fragment

Finds a fragment that was identified by the given tag either when inflated from XML or as supplied when added in a transaction.

@NonNull FragmentManager.BackStackEntry

Return the BackStackEntry at index index in the back stack; entries start index 0 being the bottom of the stack.


Return the number of entries currently in the back stack.

@Nullable Fragment

Retrieve the current Fragment instance for a reference previously placed with putFragment.

@NonNull FragmentFactory

Gets the current FragmentFactory used to instantiate new Fragment instances.

@NonNull List<Fragment>

Get a list of all fragments that are currently added to the FragmentManager.

@Nullable Fragment

Return the currently active primary navigation fragment for this FragmentManager.

@Nullable FragmentStrictMode.Policy

Returns the current policy for this FragmentManager.