added in version 22.1.0
belongs to Maven artifact com.android.support:support-fragment:28.0.0-alpha1

FragmentManager

public abstract class FragmentManager
extends Object

java.lang.Object
   ↳ android.support.v4.app.FragmentManager


Static library support version of the framework's FragmentManager. 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().

Summary

Nested classes

interface FragmentManager.BackStackEntry

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

class FragmentManager.FragmentLifecycleCallbacks

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

interface FragmentManager.OnBackStackChangedListener

Interface to watch for changes to the back stack. 

Constants

int POP_BACK_STACK_INCLUSIVE

Flag for popBackStack(String, int) and popBackStack(int, int): 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

FragmentManager()

Public methods

abstract void addOnBackStackChangedListener(FragmentManager.OnBackStackChangedListener listener)

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

abstract FragmentTransaction beginTransaction()

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

abstract void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args)

Print the FragmentManager's state into the given stream.

static void enableDebugLogging(boolean enabled)

Control whether the framework's internal fragment manager debugging logs are turned on.

abstract boolean executePendingTransactions()

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

abstract Fragment findFragmentById(int id)

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.

abstract Fragment findFragmentByTag(String tag)

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

abstract FragmentManager.BackStackEntry getBackStackEntryAt(int index)

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

abstract int getBackStackEntryCount()

Return the number of entries currently in the back stack.

abstract Fragment getFragment(Bundle bundle, String key)

Retrieve the current Fragment instance for a reference previously placed with putFragment(Bundle, String, Fragment).

abstract List<Fragment> getFragments()

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

abstract Fragment getPrimaryNavigationFragment()

Return the currently active primary navigation fragment for this FragmentManager.

abstract boolean isDestroyed()

Returns true if the final Activity.onDestroy() call has been made on the FragmentManager's Activity, so this instance is now dead.

abstract boolean isStateSaved()

Returns true if the FragmentManager's state has already been saved by its host.

abstract