Fragment Class

Definition

Caution

This class is obsoleted in this android platform

A Fragment is a piece of an application's user interface or behavior that can be placed in an Activity.

[Android.Runtime.Register("android/app/Fragment", DoNotGenerateAcw=true)]
[System.Obsolete("This class is obsoleted in this android platform")]
public class Fragment : Java.Lang.Object, Android.Content.IComponentCallbacks2, Android.Views.View.IOnCreateContextMenuListener, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/app/Fragment", DoNotGenerateAcw=true)>]
[<System.Obsolete("This class is obsoleted in this android platform")>]
type Fragment = class
    inherit Object
    interface IComponentCallbacks2
    interface IComponentCallbacks
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
    interface View.IOnCreateContextMenuListener
Inheritance
Fragment
Derived
Attributes
Implements

Remarks

Android platform documentation

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

Fragment()
Obsolete.

Default constructor.

Fragment(IntPtr, JniHandleOwnership)

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

Properties

Activity
Obsolete.

Return the Activity this fragment is currently associated with.

AllowEnterTransitionOverlap
Obsolete.

Returns whether the exit transition and enter transition overlap or not. -or- Sets whether the exit transition and enter transition overlap or not.

AllowReturnTransitionOverlap
Obsolete.

Returns whether the return transition and reenter transition overlap or not. -or- Sets whether the return transition and reenter transition overlap or not.

Arguments
Obsolete.

Return the arguments supplied to #setArguments, if any. -or- Supply the construction arguments for this fragment.

ChildFragmentManager
Obsolete.

Return a private FragmentManager for placing and managing Fragments inside of this Fragment.

Class

Returns the runtime class of this Object.

(Inherited from Object)
Context
Obsolete.

Return the Context this fragment is currently associated with.

EnterTransition
Obsolete.

Returns the Transition that will be used to move Views into the initial scene. -or- Sets the Transition that will be used to move Views into the initial scene.

ExitTransition
Obsolete.

Returns the Transition that will be used to move Views out of the scene when the fragment is removed, hidden, or detached when not popping the back stack. -or- Sets the Transition that will be used to move Views out of the scene when the fragment is removed, hidden, or detached when not popping the back stack.

FragmentManager
Obsolete.

Return the FragmentManager for interacting with fragments associated with this fragment's activity.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
Host
Obsolete.

Return the host object of this fragment.

Id
Obsolete.

Return the identifier this fragment is known by.

IsAdded
Obsolete.

Return true if the fragment is currently added to its activity.

IsDetached
Obsolete.

Return true if the fragment has been explicitly detached from the UI.

IsHidden
Obsolete.

Return true if the fragment has been hidden.

IsInLayout
Obsolete.

Return true if the layout is included as part of an activity view hierarchy via the &lt;fragment&gt; tag.

IsRemoving
Obsolete.

Return true if this fragment is currently being removed from its activity.

IsResumed
Obsolete.

Return true if the fragment is in the resumed state.

IsStateSaved
Obsolete.

Returns true if this fragment is added and its state has already been saved by its host.

IsVisible
Obsolete.

Return true if the fragment is currently visible to the user.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
LayoutInflater
Obsolete.

Returns the cached LayoutInflater used to inflate Views of this Fragment.

LoaderManager
Obsolete.

Return the LoaderManager for this fragment, creating it if needed.

ParentFragment
Obsolete.

Returns the parent Fragment containing this Fragment.

PeerReference (Inherited from Object)
ReenterTransition
Obsolete.

Returns the Transition that will be used to move Views in to the scene when returning due to popping a back stack. -or- Sets the Transition that will be used to move Views in to the scene when returning due to popping a back stack.

Resources
Obsolete.

Return <code>getActivity().

RetainInstance
Obsolete.

Control whether a fragment instance is retained across Activity re-creation (such as from a configuration change).

ReturnTransition
Obsolete.

Returns the Transition that will be used to move Views out of the scene when the Fragment is preparing to be removed, hidden, or detached because of popping the back stack. -or- Sets the Transition that will be used to move Views out of the scene when the Fragment is preparing to be removed, hidden, or detached because of popping the back stack.

SharedElementEnterTransition
Obsolete.

Returns the Transition that will be used for shared elements transferred into the content Scene. -or- Sets the Transition that will be used for shared elements transferred into the content Scene.

SharedElementReturnTransition
Obsolete.

Return the Transition that will be used for shared elements transferred back during a pop of the back stack. -or- Sets the Transition that will be used for shared elements transferred back during a pop of the back stack.

Tag
Obsolete.

Get the tag name of the fragment, if specified.

TargetFragment
Obsolete.

Return the target fragment set by #setTargetFragment.

TargetRequestCode
Obsolete.

Return the target request code set by #setTargetFragment.

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.

UserVisibleHint
Obsolete.

Set a hint to the system about whether this fragment's UI is currently visible to the user.

View
Obsolete.

Get the root view for the fragment's layout (the one returned by #onCreateView), if provided.

Methods

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[])
Obsolete.

Print the Fragments's state into the given stream.

Equals(Object)
Obsolete.

Subclasses can not override equals().

GetHashCode()
Obsolete.

Subclasses can not override hashCode().

GetString(Int32)
Obsolete.

Return a localized string from the application's package's default string table.

GetString(Int32, Object[])
Obsolete.

Return a localized string from the application's package's default string table.

GetText(Int32)
Obsolete.

Return a localized, styled CharSequence from the application's package's default string table.

GetTextFormatted(Int32)
Obsolete.

Return a localized, styled CharSequence from the application's package's default string table.

Instantiate(Context, String)
Obsolete.

Like #instantiate(Context, String, Bundle) but with a null argument Bundle.

Instantiate(Context, String, Bundle)
Obsolete.

Create a new instance of a Fragment with the given class name.

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)
OnActivityCreated(Bundle)
Obsolete.

Called when the fragment's activity has been created and this fragment's view hierarchy instantiated.

OnActivityResult(Int32, Result, Intent)
Obsolete.

Receive the result from a previous call to #startActivityForResult(Intent, int).

OnAttach(Activity)
OnAttach(Context)
Obsolete.

Called when a fragment is first attached to its context.

OnAttachFragment(Fragment)
Obsolete.

Called when a fragment is attached as a child of this fragment.

OnConfigurationChanged(Configuration)
Obsolete.

Called by the system when the device configuration changes while your component is running.

OnContextItemSelected(IMenuItem)
Obsolete.

This hook is called whenever an item in a context menu is selected.

OnCreate(Bundle)
Obsolete.

Called to do initial creation of a fragment.

OnCreateAnimator(FragmentTransit, Boolean, Int32)
Obsolete.

Called when a fragment loads an animation.

OnCreateContextMenu(IContextMenu, View, IContextMenuContextMenuInfo)
Obsolete.

Called when a context menu for the view is about to be shown.

OnCreateOptionsMenu(IMenu, MenuInflater)
Obsolete.

Initialize the contents of the Activity's standard options menu.

OnCreateView(LayoutInflater, ViewGroup, Bundle)
Obsolete.

Called to have the fragment instantiate its user interface view.

OnDestroy()
Obsolete.

Called when the fragment is no longer in use.

OnDestroyOptionsMenu()
Obsolete.

Called when this fragment's option menu items are no longer being included in the overall options menu.

OnDestroyView()
Obsolete.

Called when the view previously created by #onCreateView has been detached from the fragment.

OnDetach()
Obsolete.

Called when the fragment is no longer attached to its activity.

OnGetLayoutInflater(Bundle)
Obsolete.

Returns the LayoutInflater used to inflate Views of this Fragment.

OnHiddenChanged(Boolean)
Obsolete.

Called when the hidden state (as returned by #isHidden() of the fragment has changed.

OnInflate(Activity, IAttributeSet, Bundle)
OnInflate(Context, IAttributeSet, Bundle)
OnInflate(IAttributeSet, Bundle)
OnLowMemory()
Obsolete.

This is called when the overall system is running low on memory, and actively running processes should trim their memory usage.

OnMultiWindowModeChanged(Boolean)
Obsolete.

Called when the Fragment's activity changes from fullscreen mode to multi-window mode and visa-versa.

OnMultiWindowModeChanged(Boolean, Configuration)
Obsolete.

Called when the Fragment's activity changes from fullscreen mode to multi-window mode and visa-versa.

OnOptionsItemSelected(IMenuItem)
Obsolete.

This hook is called whenever an item in your options menu is selected.

OnOptionsMenuClosed(IMenu)
Obsolete.

This hook is called whenever the options menu is being closed (either by the user canceling the menu with the back/menu button, or when an item is selected).

OnPause()
Obsolete.

Called when the Fragment is no longer resumed.

OnPictureInPictureModeChanged(Boolean)
Obsolete.

Called by the system when the activity changes to and from picture-in-picture mode.

OnPictureInPictureModeChanged(Boolean, Configuration)
Obsolete.

Called by the system when the activity changes to and from picture-in-picture mode.

OnPrepareOptionsMenu(IMenu)
Obsolete.

Prepare the Screen's standard options menu to be displayed.

OnRequestPermissionsResult(Int32, String[], Permission[])
Obsolete.

Callback for the result from requesting permissions.

OnResume()
Obsolete.

Called when the fragment is visible to the user and actively running.

OnSaveInstanceState(Bundle)
Obsolete.

Called to ask the fragment to save its current dynamic state, so it can later be reconstructed in a new instance of its process is restarted.

OnStart()
Obsolete.

Called when the Fragment is visible to the user.

OnStop()
Obsolete.

Called when the Fragment is no longer started.

OnTrimMemory(TrimMemory)
Obsolete.

Called when the operating system has determined that it is a good time for a process to trim unneeded memory from its process.

OnViewCreated(View, Bundle)
Obsolete.

Called immediately after #onCreateView(LayoutInflater, ViewGroup, Bundle) has returned, but before any saved state has been restored in to the view.

OnViewStateRestored(Bundle)
Obsolete.

Called when all saved state has been restored into the view hierarchy of the fragment.

PostponeEnterTransition()
RegisterForContextMenu(View)
Obsolete.

Registers a context menu to be shown for the given view (multiple views can show the context menu).

RequestPermissions(String[], Int32)
Obsolete.

Requests permissions to be granted to this application.

SetEnterSharedElementCallback(SharedElementCallback)
Obsolete.

When custom transitions are used with Fragments, the enter transition callback is called when this Fragment is attached or detached when not popping the back stack.

SetExitSharedElementCallback(SharedElementCallback)
Obsolete.

When custom transitions are used with Fragments, the exit transition callback is called when this Fragment is attached or detached when popping the back stack.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetHasOptionsMenu(Boolean)
Obsolete.

Report that this fragment would like to participate in populating the options menu by receiving a call to #onCreateOptionsMenu and related methods.

SetInitialSavedState(Fragment+SavedState)
Obsolete.

Set the initial saved state that this Fragment should restore itself from when first being constructed, as returned by FragmentManager#saveFragmentInstanceState(Fragment) FragmentManager.saveFragmentInstanceState.

SetMenuVisibility(Boolean)
Obsolete.

Set a hint for whether this fragment's menu should be visible.

SetTargetFragment(Fragment, Int32)
Obsolete.

Optional target for this fragment.

ShouldShowRequestPermissionRationale(String)
Obsolete.

Gets whether you should show UI with rationale before requesting a permission.

StartActivity(Intent)
Obsolete.

Call Activity#startActivity(Intent) from the fragment's containing Activity.

StartActivity(Intent, Bundle)
Obsolete.

Call Activity#startActivity(Intent) from the fragment's containing Activity.

StartActivityForResult(Intent, Int32)
Obsolete.

Call Activity#startActivityForResult(Intent, int) from the fragment's containing Activity.

StartActivityForResult(Intent, Int32, Bundle)
Obsolete.

Call Activity#startActivityForResult(Intent, int, Bundle) from the fragment's containing Activity.

StartIntentSenderForResult(IntentSender, Int32, Intent, ActivityFlags, ActivityFlags, Int32, Bundle)
Obsolete.

Call Activity#startIntentSenderForResult(IntentSender, int, Intent, int, int, int, Bundle) from the fragment's containing Activity.

StartPostponedEnterTransition()
Obsolete.

Begin postponed transitions after #postponeEnterTransition() was called.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterForContextMenu(View)
Obsolete.

Prevents a context menu to be shown for the given view.

UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until either another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object, or a specified amount of time has elapsed.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.

(Inherited from Object)

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