共用方式為


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

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

For more information about using fragments, read the Fragments developer guide.

</div>

While the FragmentManager API was introduced in android.os.Build.VERSION_CODES#HONEYCOMB, a version of the API at is also available for use on older platforms through androidx.fragment.app.FragmentActivity. See the blog post Fragments For All for more details.

This member is deprecated. Use the Support Libraryandroidx.fragment.app.FragmentManager for consistent behavior across all devices and access to Lifecycle.

Java documentation 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

FragmentManager()
FragmentManager(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Fields

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

BackStackEntryCount

Return the number of entries currently in the back stack.

Class

Returns the runtime class of this Object.

(Inherited from Object)
Fragments
Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsDestroyed

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

IsStateSaved
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
PrimaryNavigationFragment
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

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)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
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)

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)
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)
GetBackStackEntryAt(Int32)

Return the BackStackEntry at index <var>index</var> 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)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
InvalidateOptionsMenu()

Invalidate the attached activity's options menu as necessary.

JavaFinalize()

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)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFragmentLifecycleCallbacks(FragmentManager+FragmentLifecycleCallbacks)

Unregisters a previously registered FragmentLifecycleCallbacks.

UnregisterFromRuntime() (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

BackStackChanged

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to