Methods Summary |
---|
public abstract void | addOnBackStackChangedListener(android.support.v4.app.FragmentManager$OnBackStackChangedListener listener)Add a new listener for changes to the fragment back stack.
|
public abstract FragmentTransaction | beginTransaction()Start a series of edit operations on the Fragments associated with
this FragmentManager.
Note: A fragment transaction can only be created/committed prior
to an activity saving its state. If you try to commit a transaction
after {@link FragmentActivity#onSaveInstanceState FragmentActivity.onSaveInstanceState()}
(and prior to a following {@link FragmentActivity#onStart FragmentActivity.onStart}
or {@link FragmentActivity#onResume FragmentActivity.onResume()}, you will get an error.
This is because the framework takes care of saving your current fragments
in the state, and if changes are made after the state is saved then they
will be lost.
|
public abstract void | dump(java.lang.String prefix, java.io.FileDescriptor fd, java.io.PrintWriter writer, java.lang.String[] args)Print the FragmentManager's state into the given stream.
|
public static void | enableDebugLogging(boolean enabled)Control whether the framework's internal fragment manager debugging
logs are turned on. If enabled, you will see output in logcat as
the framework performs fragment operations.
FragmentManagerImpl.DEBUG = enabled;
|
public abstract boolean | executePendingTransactions()After a {@link FragmentTransaction} is committed with
{@link FragmentTransaction#commit FragmentTransaction.commit()}, it
is scheduled to be executed asynchronously on the process's main thread.
If you want to immediately executing any such pending operations, you
can call this function (only from the main thread) to do so. Note that
all callbacks and other related behavior will be done from within this
call, so be careful about where this is called from.
|
public 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. This first
searches through fragments that are currently added to the manager's
activity; if no such fragment is found, then all fragments currently
on the back stack associated with this ID are searched.
|
public abstract Fragment | findFragmentByTag(java.lang.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. This first
searches through fragments that are currently added to the manager's
activity; if no such fragment is found, then all fragments currently
on the back stack are searched.
|
public abstract android.support.v4.app.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.
|
public abstract int | getBackStackEntryCount()Return the number of entries currently in the back stack.
|
public abstract Fragment | getFragment(android.os.Bundle bundle, java.lang.String key)Retrieve the current Fragment instance for a reference previously
placed with {@link #putFragment(Bundle, String, Fragment)}.
|
public abstract java.util.List | getFragments()Get a list of all fragments that have been added to the fragment manager.
|
public abstract boolean | isDestroyed()Returns true if the final {@link android.app.Activity#onDestroy() Activity.onDestroy()}
call has been made on the FragmentManager's Activity, so this instance is now dead.
|
public FragmentTransaction | openTransaction()
return beginTransaction();
|
public abstract void | popBackStack(int id, int flags)Pop all back stack states up to the one with the given identifier.
This function is asynchronous -- it enqueues the
request to pop, but the action will not be performed until the application
returns to its event loop.
|
public abstract void | popBackStack()Pop the top state off the back stack. Returns true if there was one
to pop, else false. This function is asynchronous -- it enqueues the
request to pop, but the action will not be performed until the application
returns to its event loop.
|
public abstract void | popBackStack(java.lang.String name, int flags)Pop the last fragment transition from the manager's fragment
back stack. If there is nothing to pop, false is returned.
This function is asynchronous -- it enqueues the
request to pop, but the action will not be performed until the application
returns to its event loop.
|
public abstract boolean | popBackStackImmediate(int id, int flags)Like {@link #popBackStack(int, int)}, but performs the operation immediately
inside of the call. This is like calling {@link #executePendingTransactions()}
afterwards.
|
public abstract boolean | popBackStackImmediate()Like {@link #popBackStack()}, but performs the operation immediately
inside of the call. This is like calling {@link #executePendingTransactions()}
afterwards.
|
public abstract boolean | popBackStackImmediate(java.lang.String name, int flags)Like {@link #popBackStack(String, int)}, but performs the operation immediately
inside of the call. This is like calling {@link #executePendingTransactions()}
afterwards.
|
public abstract void | putFragment(android.os.Bundle bundle, java.lang.String key, Fragment fragment)Put a reference to a fragment in a Bundle. This Bundle can be
persisted as saved state, and when later restoring
{@link #getFragment(Bundle, String)} will return the current
instance of the same fragment.
|
public abstract void | removeOnBackStackChangedListener(android.support.v4.app.FragmentManager$OnBackStackChangedListener listener)Remove a listener that was previously added with
{@link #addOnBackStackChangedListener(OnBackStackChangedListener)}.
|
public abstract Fragment.SavedState | saveFragmentInstanceState(Fragment f)Save the current instance state of the given Fragment. This can be
used later when creating a new instance of the Fragment and adding
it to the fragment manager, to have it create itself to match the
current state returned here. Note that there are limits on how
this can be used:
- The Fragment must currently be attached to the FragmentManager.
- A new Fragment created using this saved state must be the same class
type as the Fragment it was created from.
- The saved state can not contain dependencies on other fragments --
that is it can't use {@link #putFragment(Bundle, String, Fragment)} to
store a fragment reference because that reference may not be valid when
this saved state is later used. Likewise the Fragment's target and
result code are not included in this state.
|