Language

FragmentManager Class

Definition

Interface for interacting with Fragment objects inside of an Activity<div class="special reference"> <h3>Developer Guides</h3>

[Android.Runtime.Register("android/app/FragmentManager", DoNotGenerateAcw=true)]
public abstract class FragmentManager : Java.Lang.Object
[<Android.Runtime.Register("android/app/FragmentManager", DoNotGenerateAcw=true)>]
type FragmentManager = class
    inherit Object
Inheritance
FragmentManager
Attributes

Remarks

This class was deprecated in API level 28. Use the Support Library FragmentManager for consistent behavior across all devices and access to Lifecycle.

Interface for interacting with Fragment objects inside of an Activity Developer Guides For more information about using fragments, read the Fragments developer guide.

Android reference for android.app.FragmentManager.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

Name Description
FragmentManager()
FragmentManager(IntPtr, JniHandleOwnership)

Initializes a managed representation of an existing Java Native Interface object.

Fields

Name Description
PopBackStackInclusive

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.

Properties

Name Description
BackStackEntryCount

Return the number of entries currently in the back stack.

Class

Returns the runtime class of this Object.

(Inherited from Object)
Fragments

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

Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsDestroyed

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

IsStateSaved

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

JniIdentityHashCode

Gets the identity hash code assigned to this Java peer by the interop runtime.

(Inherited from Object)
JniManagedPeerState (Inherited from JavaObject)
JniPeerMembers

Provides JNI binding infrastructure for Android.App.FragmentManager.

PeerReference

Gets the JNI object reference for this Java peer.

(Inherited from Object)
PrimaryNavigationFragment

Return the currently active primary navigation fragment for this FragmentManager.

ThresholdClass

Provides JNI binding infrastructure for Android.App.FragmentManager.

ThresholdType

Provides JNI binding infrastructure for Android.App.FragmentManager.

Methods

Name Description
AddOnBackStackChangedListener(FragmentManager+IOnBackStackChangedListener)

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

BeginTransaction()

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

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Construct(JniObjectReference, JniObjectReferenceOptions) (Inherited from JavaObject)
Dispose()

Releases the resources held by this Java peer.

(Inherited from Object)
Dispose(Boolean)

Releases the resources held by this Java peer.

(Inherited from Object)
DisposeUnlessReferenced() (Inherited from JavaObject)
Dump(String, FileDescriptor, PrintWriter, String[])

Print the FragmentManager's state into the given stream.

EnableDebugLogging(Boolean)

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

Equals(Object) (Inherited from JavaObject)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
ExecutePendingTransactions()

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

FindFragmentById(Int32)

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.

FindFragmentById<T>(Int32)

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, and returns it cast to T.

FindFragmentByTag(String)

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

FindFragmentByTag<T>(String)

Finds a Fragment that was identified by the given tag, either when inflated from XML or as supplied when added in a transaction, and returns it cast to T.

GetBackStackEntryAt(Int32)

Return the BackStackEntry at index index in the back stack; where the item on the bottom of the stack has index 0.

GetFragment(Bundle, String)

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

GetFragment<T>(Bundle, String)

Retrieves the current Fragment instance for a reference previously placed in bundle with PutFragment, and returns it cast to T.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
InvalidateOptionsMenu()

Invalidate the attached activity's options menu as necessary.

JavaFinalize()
Obsolete.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
PopBackStack()

Pop the top state off the back stack.

PopBackStack(Int32, PopBackStackFlags)

Pop all back stack states up to the one with the given identifier.

PopBackStack(String, PopBackStackFlags)

Pop the last fragment transition from the manager's fragment back stack.

PopBackStackImmediate()

Like #popBackStack(), but performs the operation immediately inside of the call.

PopBackStackImmediate(Int32, PopBackStackFlags)

Like #popBackStack(int, int), but performs the operation immediately inside of the call.

PopBackStackImmediate(String, PopBackStackFlags)

Like #popBackStack(String, int), but performs the operation immediately inside of the call.

PutFragment(Bundle, String, Fragment)

Put a reference to a fragment in a Bundle.

RegisterFragmentLifecycleCallbacks(FragmentManager+FragmentLifecycleCallbacks, Boolean)

Registers a FragmentLifecycleCallbacks to listen to fragment lifecycle events happening in this FragmentManager.

RemoveOnBackStackChangedListener(FragmentManager+IOnBackStackChangedListener)

Remove a listener that was previously added with addOnBackStackChangedListener(OnBackStackChangedListener).

SaveFragmentInstanceState(Fragment)

Save the current instance state of the given Fragment.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetPeerReference(JniObjectReference, JniObjectReferenceOptions) (Inherited from JavaObject)
ToArray<T>()

Creates a managed array from this Java array wrapper.

(Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFragmentLifecycleCallbacks(FragmentManager+FragmentLifecycleCallbacks)

Unregisters a previously registered FragmentLifecycleCallbacks.

UnregisterFromRuntime()

Unregisters this Java peer from the interop runtime.

(Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Events

Name Description
BackStackChanged

Explicit Interface Implementations

Name Description
IJavaPeerable.Disposed() (Inherited from JavaObject)
IJavaPeerable.Finalized() (Inherited from JavaObject)
IJavaPeerable.JniObjectReferenceControlBlock (Inherited from JavaObject)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from JavaObject)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from JavaObject)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from JavaObject)

Extension Methods

Name Description
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to