# Fragment

Artifact: [androidx.fragment:fragment](https://developer.android.com/jetpack/androidx/releases/fragment) [View Source](https://cs.android.com/search?q=file:androidx/fragment/app/Fragment.java+class:androidx.fragment.app.Fragment) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

*** ** * ** ***


```
public class Fragment implements ComponentCallbacks, View.OnCreateContextMenuListener, LifecycleOwner, ViewModelStoreOwner, HasDefaultViewModelProviderFactory, SavedStateRegistryOwner, ActivityResultCaller, ContextAware
```

<br />

Known direct subclasses [AbstractListDetailFragment](https://developer.android.com/reference/androidx/navigation/fragment/AbstractListDetailFragment), [AbstractProgressFragment](https://developer.android.com/reference/androidx/navigation/dynamicfeatures/fragment/ui/AbstractProgressFragment), [AmbientModeSupport](https://developer.android.com/reference/androidx/wear/ambient/AmbientModeSupport), [BrandedSupportFragment](https://developer.android.com/reference/androidx/leanback/app/BrandedSupportFragment), [DialogFragment](https://developer.android.com/reference/androidx/fragment/app/DialogFragment), [GuidedStepSupportFragment](https://developer.android.com/reference/androidx/leanback/app/GuidedStepSupportFragment), [HeadersSupportFragment](https://developer.android.com/reference/androidx/leanback/app/HeadersSupportFragment), [LeanbackPreferenceDialogFragmentCompat](https://developer.android.com/reference/androidx/leanback/preference/LeanbackPreferenceDialogFragmentCompat), [LeanbackSettingsFragmentCompat](https://developer.android.com/reference/androidx/leanback/preference/LeanbackSettingsFragmentCompat), [ListFragment](https://developer.android.com/reference/androidx/fragment/app/ListFragment), [MediaRouteDiscoveryFragment](https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteDiscoveryFragment), [NavHostFragment](https://developer.android.com/reference/androidx/navigation/fragment/NavHostFragment), [OnboardingSupportFragment](https://developer.android.com/reference/androidx/leanback/app/OnboardingSupportFragment), [PdfViewerFragment](https://developer.android.com/reference/androidx/pdf/viewer/fragment/PdfViewerFragment), [PlaybackSupportFragment](https://developer.android.com/reference/androidx/leanback/app/PlaybackSupportFragment), [PreferenceFragmentCompat](https://developer.android.com/reference/androidx/preference/PreferenceFragmentCompat), [PreferenceHeaderFragmentCompat](https://developer.android.com/reference/androidx/preference/PreferenceHeaderFragmentCompat), [RowsSupportFragment](https://developer.android.com/reference/androidx/leanback/app/RowsSupportFragment), [SearchSupportFragment](https://developer.android.com/reference/androidx/leanback/app/SearchSupportFragment)

|---|---|
| `https://developer.android.com/reference/androidx/navigation/fragment/AbstractListDetailFragment` | A fragment supports adaptive two-pane layout. |
| `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/fragment/ui/AbstractProgressFragment` | The base class for `https://developer.android.com/reference/androidx/fragment/app/Fragment`s that handle dynamic feature installation. |
| `https://developer.android.com/reference/androidx/wear/ambient/AmbientModeSupport` | **This class is deprecated.** Use `https://developer.android.com/reference/androidx/wear/ambient/AmbientLifecycleObserver` instead. <br /> |
| `https://developer.android.com/reference/androidx/leanback/app/BrandedSupportFragment` | Fragment class for managing search and branding using a view that implements `https://developer.android.com/reference/androidx/leanback/widget/TitleViewAdapter.Provider`. |
| `https://developer.android.com/reference/androidx/fragment/app/DialogFragment` | A fragment that displays a dialog window, floating in the foreground of its activity's window. |
| `https://developer.android.com/reference/androidx/leanback/app/GuidedStepSupportFragment` | A GuidedStepSupportFragment is used to guide the user through a decision or series of decisions. |
| `https://developer.android.com/reference/androidx/leanback/app/HeadersSupportFragment` | An fragment containing a list of row headers. |
| `https://developer.android.com/reference/androidx/leanback/preference/LeanbackPreferenceDialogFragmentCompat` | A fragment that shows `https://developer.android.com/reference/androidx/preference/DialogPreference`, for example `https://developer.android.com/reference/androidx/preference/ListPreference` or `https://developer.android.com/reference/androidx/preference/MultiSelectListPreference`. |
| `https://developer.android.com/reference/androidx/leanback/preference/LeanbackSettingsFragmentCompat` | This fragment provides a container for displaying a `https://developer.android.com/reference/androidx/leanback/preference/LeanbackPreferenceFragmentCompat` |
| `https://developer.android.com/reference/androidx/fragment/app/ListFragment` | Static library support version of the framework's `https://developer.android.com/reference/android/app/ListFragment.html`. |
| `https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteDiscoveryFragment` | Media route discovery fragment. |
| `https://developer.android.com/reference/androidx/navigation/fragment/NavHostFragment` | NavHostFragment provides an area within your layout for self-contained navigation to occur. |
| `https://developer.android.com/reference/androidx/leanback/app/OnboardingSupportFragment` | An OnboardingSupportFragment provides a common and simple way to build onboarding screen for applications. |
| `https://developer.android.com/reference/androidx/pdf/viewer/fragment/PdfViewerFragment` | A Fragment that renders a PDF document. |
| `https://developer.android.com/reference/androidx/leanback/app/PlaybackSupportFragment` | A fragment for displaying playback controls and related content. |
| `https://developer.android.com/reference/androidx/preference/PreferenceFragmentCompat` | A PreferenceFragmentCompat is the entry point to using the Preference library. |
| `https://developer.android.com/reference/androidx/preference/PreferenceHeaderFragmentCompat` | `https://developer.android.com/reference/androidx/preference/PreferenceHeaderFragmentCompat` implements a two-pane fragment for preferences. |
| `https://developer.android.com/reference/androidx/leanback/app/RowsSupportFragment` | An ordered set of rows of leanback widgets. |
| `https://developer.android.com/reference/androidx/leanback/app/SearchSupportFragment` | A fragment to handle searches. |

Known indirect subclasses [AppCompatDialogFragment](https://developer.android.com/reference/androidx/appcompat/app/AppCompatDialogFragment), [BaseLeanbackPreferenceFragmentCompat](https://developer.android.com/reference/androidx/leanback/preference/BaseLeanbackPreferenceFragmentCompat), [BaseSupportFragment](https://developer.android.com/reference/androidx/leanback/app/BaseSupportFragment), [BrowseSupportFragment](https://developer.android.com/reference/androidx/leanback/app/BrowseSupportFragment), [DefaultProgressFragment](https://developer.android.com/reference/androidx/navigation/dynamicfeatures/fragment/ui/DefaultProgressFragment), [DetailsSupportFragment](https://developer.android.com/reference/androidx/leanback/app/DetailsSupportFragment), [DynamicNavHostFragment](https://developer.android.com/reference/androidx/navigation/dynamicfeatures/fragment/DynamicNavHostFragment), [EditTextPreferenceDialogFragmentCompat](https://developer.android.com/reference/androidx/preference/EditTextPreferenceDialogFragmentCompat), [EditablePdfViewerFragment](https://developer.android.com/reference/androidx/pdf/ink/EditablePdfViewerFragment), [ErrorSupportFragment](https://developer.android.com/reference/androidx/leanback/app/ErrorSupportFragment), [LeanbackEditTextPreferenceDialogFragmentCompat](https://developer.android.com/reference/androidx/leanback/preference/LeanbackEditTextPreferenceDialogFragmentCompat), [LeanbackListPreferenceDialogFragmentCompat](https://developer.android.com/reference/androidx/leanback/preference/LeanbackListPreferenceDialogFragmentCompat), [LeanbackPreferenceFragmentCompat](https://developer.android.com/reference/androidx/leanback/preference/LeanbackPreferenceFragmentCompat), [ListPreferenceDialogFragmentCompat](https://developer.android.com/reference/androidx/preference/ListPreferenceDialogFragmentCompat), [MediaRouteChooserDialogFragment](https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteChooserDialogFragment), [MediaRouteControllerDialogFragment](https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteControllerDialogFragment), [MultiSelectListPreferenceDialogFragmentCompat](https://developer.android.com/reference/androidx/preference/MultiSelectListPreferenceDialogFragmentCompat), [PreferenceDialogFragmentCompat](https://developer.android.com/reference/androidx/preference/PreferenceDialogFragmentCompat), [VerticalGridSupportFragment](https://developer.android.com/reference/androidx/leanback/app/VerticalGridSupportFragment), [VideoSupportFragment](https://developer.android.com/reference/androidx/leanback/app/VideoSupportFragment)

|---|---|
| `https://developer.android.com/reference/androidx/appcompat/app/AppCompatDialogFragment` | A special version of `https://developer.android.com/reference/androidx/fragment/app/DialogFragment` which uses an `https://developer.android.com/reference/androidx/appcompat/app/AppCompatDialog` in place of a platform-styled dialog. |
| `https://developer.android.com/reference/androidx/leanback/preference/BaseLeanbackPreferenceFragmentCompat` | This fragment provides a preference fragment with leanback-style behavior, suitable for embedding into broader UI elements. |
| `https://developer.android.com/reference/androidx/leanback/app/BaseSupportFragment` | Base class for leanback Fragments. |
| `https://developer.android.com/reference/androidx/leanback/app/BrowseSupportFragment` | A fragment for creating Leanback browse screens. |
| `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/fragment/ui/DefaultProgressFragment` | The default `https://developer.android.com/reference/androidx/fragment/app/Fragment` to display during installation progress. |
| `https://developer.android.com/reference/androidx/leanback/app/DetailsSupportFragment` | A fragment for creating Leanback details screens. |
| `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/fragment/DynamicNavHostFragment` | The `https://developer.android.com/reference/androidx/navigation/fragment/NavHostFragment` for dynamic features. |
| `https://developer.android.com/reference/androidx/preference/EditTextPreferenceDialogFragmentCompat` |   |
| `https://developer.android.com/reference/androidx/pdf/ink/EditablePdfViewerFragment` | A `https://developer.android.com/reference/androidx/fragment/app/Fragment` that extends `https://developer.android.com/reference/androidx/pdf/viewer/fragment/PdfViewerFragment` to provide PDF editing capabilities, including annotation and form filling, leveraging the 'androidx.ink' library. |
| `https://developer.android.com/reference/androidx/leanback/app/ErrorSupportFragment` | A fragment for displaying an error indication. |
| `https://developer.android.com/reference/androidx/leanback/preference/LeanbackEditTextPreferenceDialogFragmentCompat` | Implemented a dialog to input text. |
| `https://developer.android.com/reference/androidx/leanback/preference/LeanbackListPreferenceDialogFragmentCompat` | Implemented a dialog to show `https://developer.android.com/reference/androidx/preference/ListPreference` or `https://developer.android.com/reference/androidx/preference/MultiSelectListPreference`. |
| `https://developer.android.com/reference/androidx/leanback/preference/LeanbackPreferenceFragmentCompat` | This fragment provides a fully decorated leanback-style preference fragment, including a list background and header. |
| `https://developer.android.com/reference/androidx/preference/ListPreferenceDialogFragmentCompat` |   |
| `https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteChooserDialogFragment` | Media route chooser dialog fragment. |
| `https://developer.android.com/reference/androidx/mediarouter/app/MediaRouteControllerDialogFragment` | Media route controller dialog fragment. |
| `https://developer.android.com/reference/androidx/preference/MultiSelectListPreferenceDialogFragmentCompat` |   |
| `https://developer.android.com/reference/androidx/preference/PreferenceDialogFragmentCompat` | Abstract base class which presents a dialog associated with a `https://developer.android.com/reference/androidx/preference/DialogPreference`. |
| `https://developer.android.com/reference/androidx/leanback/app/VerticalGridSupportFragment` | A fragment for creating leanback vertical grids. |
| `https://developer.android.com/reference/androidx/leanback/app/VideoSupportFragment` | Subclass of `https://developer.android.com/reference/androidx/leanback/app/PlaybackSupportFragment` that is responsible for providing a `https://developer.android.com/reference/android/view/SurfaceView.html` and rendering video. |

*** ** * ** ***

Static library support version of the framework's `https://developer.android.com/reference/android/app/Fragment.html`. 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 `https://developer.android.com/reference/android/app/Fragment.html` documentation for a class overview.

The main differences when using this support version instead of the framework version are:

- Your activity must extend `https://developer.android.com/reference/androidx/fragment/app/FragmentActivity`
- You must call `https://developer.android.com/reference/androidx/fragment/app/FragmentActivity#getSupportFragmentManager()` to get the `https://developer.android.com/reference/androidx/fragment/app/FragmentManager`

## Summary

| ### Nested types |
|---|
| `public class https://developer.android.com/reference/androidx/fragment/app/Fragment.InstantiationException extends https://developer.android.com/reference/java/lang/RuntimeException.html` Thrown by `https://developer.android.com/reference/androidx/fragment/app/FragmentFactory#instantiate(java.lang.ClassLoader,java.lang.String)` when there is an instantiation failure. |
| `public class https://developer.android.com/reference/androidx/fragment/app/Fragment.SavedState implements https://developer.android.com/reference/android/os/Parcelable.html` State information that has been retrieved from a fragment instance through `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#saveFragmentInstanceState(androidx.fragment.app.Fragment)`. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#Fragment()()` Constructor used by the default `https://developer.android.com/reference/androidx/fragment/app/FragmentFactory`. |
| `@https://developer.android.com/reference/androidx/annotation/ContentView https://developer.android.com/reference/androidx/fragment/app/Fragment#Fragment(int)(@https://developer.android.com/reference/androidx/annotation/LayoutRes int contentLayoutId)` Alternate constructor that can be called from your default, no argument constructor to provide a default layout that will be inflated by `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`. |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#addOnContextAvailableListener(androidx.activity.contextaware.OnContextAvailableListener)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/activity/contextaware/OnContextAvailableListener listener )` Add a new `https://developer.android.com/reference/androidx/activity/contextaware/OnContextAvailableListener` for receiving a callback for when this class is associated with a `https://developer.android.com/reference/android/content/Context.html`. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#dump(java.lang.String,java.io.FileDescriptor,java.io.PrintWriter,java.lang.String[])( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html prefix, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/io/FileDescriptor.html fd, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/io/PrintWriter.html writer, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html String[] args )` Print the Fragments's state into the given stream. |
| `final boolean` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#equals(java.lang.Object)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html o)` Subclasses can not override equals(). |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/fragment/app/FragmentActivity` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getActivity()()` Return the `https://developer.android.com/reference/androidx/fragment/app/FragmentActivity` this fragment is currently associated with. |
| `boolean` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getAllowEnterTransitionOverlap()()` Returns whether the the exit transition and enter transition overlap or not. |
| `boolean` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getAllowReturnTransitionOverlap()()` Returns whether the the return transition and reenter transition overlap or not. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getArguments()()` Return the arguments supplied when the fragment was instantiated, if any. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/fragment/app/FragmentManager` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getChildFragmentManager()()` Return a private FragmentManager for placing and managing Fragments inside of this Fragment. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/Context.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getContext()()` Return the `https://developer.android.com/reference/android/content/Context.html` this fragment is currently associated with. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras` | `@https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/fragment/app/Fragment#getDefaultViewModelCreationExtras()()` The default `https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras` to pass into `https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory#create(kotlin.reflect.KClass,androidx.lifecycle.viewmodel.CreationExtras)` when no overriding `https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras` are provided. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getDefaultViewModelProviderFactory()()` The default `https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory` to use when no custom `https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory` is provided to the `https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getEnterTransition()()` Returns the Transition that will be used to move Views into the initial scene. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getExitTransition()()` 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. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/fragment/app/FragmentManager` | `[getFragmentManager](https://developer.android.com/reference/androidx/fragment/app/Fragment#getFragmentManager())()` **This method is deprecated.** This has been removed in favor of `getParentFragmentManager()` which throws an `https://developer.android.com/reference/java/lang/IllegalStateException.html` if the FragmentManager is null. <br /> |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getHost()()` Return the host object of this fragment. |
| `final int` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getId()()` Return the identifier this fragment is known by. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/LayoutInflater.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getLayoutInflater()()` Returns the cached LayoutInflater used to inflate Views of this Fragment. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/lifecycle/Lifecycle` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getLifecycle()()` The `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` of this owner. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/loader/app/LoaderManager` | `[getLoaderManager](https://developer.android.com/reference/androidx/fragment/app/Fragment#getLoaderManager())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/loader/app/LoaderManager#getInstance(T)`. <br /> |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/fragment/app/Fragment` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getParentFragment()()` Returns the parent Fragment containing this Fragment. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/fragment/app/FragmentManager` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getParentFragmentManager()()` Return the FragmentManager for interacting with fragments associated with this fragment's activity. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getReenterTransition()()` Returns the Transition that will be used to move Views in to the scene when returning due to popping a back stack. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/res/Resources.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getResources()()` Return `requireActivity().getResources()`. |
| `final boolean` | `[getRetainInstance](https://developer.android.com/reference/androidx/fragment/app/Fragment#getRetainInstance())()` **This method is deprecated.** Instead of retaining the Fragment itself, use a non-retained Fragment and keep retained state in a ViewModel attached to that Fragment. <br /> |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getReturnTransition()()` 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. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/savedstate/SavedStateRegistry` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getSavedStateRegistry()()` The `https://developer.android.com/reference/androidx/savedstate/SavedStateRegistry` owned by this `https://developer.android.com/reference/androidx/savedstate/SavedStateRegistryOwner`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getSharedElementEnterTransition()()` Returns the Transition that will be used for shared elements transferred into the content Scene. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getSharedElementReturnTransition()()` Return the Transition that will be used for shared elements transferred back during a pop of the back stack. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getString(int)(@https://developer.android.com/reference/androidx/annotation/StringRes int resId)` Return a localized string from the application's package's default string table. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getString(int,java.lang.Object...)(@https://developer.android.com/reference/androidx/annotation/StringRes int resId, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html Object[] formatArgs)` Return a localized formatted string from the application's package's default string table, substituting the format arguments as defined in `https://developer.android.com/reference/java/util/Formatter.html` and `https://developer.android.com/reference/java/lang/String.html#format(java.lang.String, java.lang.Object...)`. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getTag()()` Get the tag name of the fragment, if specified. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/fragment/app/Fragment` | `[getTargetFragment](https://developer.android.com/reference/androidx/fragment/app/Fragment#getTargetFragment())()` **This method is deprecated.** Instead of using a target fragment to pass results, use `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#setFragmentResult(java.lang.String,android.os.Bundle)` to deliver results to `https://developer.android.com/reference/androidx/fragment/app/FragmentResultListener` instances registered by other fragments via `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)`. <br /> |
| `final int` | `[getTargetRequestCode](https://developer.android.com/reference/androidx/fragment/app/Fragment#getTargetRequestCode())()` **This method is deprecated.** When using the target fragment replacement of `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)` and `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#setFragmentResult(java.lang.String,android.os.Bundle)`, consider using `https://developer.android.com/reference/androidx/fragment/app/Fragment#setArguments(android.os.Bundle)` to pass a `requestKey` if you need to support dynamic request keys. <br /> |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/CharSequence.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getText(int)(@https://developer.android.com/reference/androidx/annotation/StringRes int resId)` Return a localized, styled CharSequence from the application's package's default string table. |
| `boolean` | `[getUserVisibleHint](https://developer.android.com/reference/androidx/fragment/app/Fragment#getUserVisibleHint())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#setMaxLifecycle(androidx.fragment.app.Fragment,androidx.lifecycle.Lifecycle.State)` instead. <br /> |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/view/View.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getView()()` Get the root view for the fragment's layout (the one returned by `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`), if provided. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` | `@https://developer.android.com/reference/androidx/annotation/MainThread https://developer.android.com/reference/androidx/fragment/app/Fragment#getViewLifecycleOwner()()` Get a `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` that represents the `https://developer.android.com/reference/androidx/fragment/app/Fragment#getView()` lifecycle. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/lifecycle/LiveData<https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner>` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getViewLifecycleOwnerLiveData()()` Retrieve a `https://developer.android.com/reference/androidx/lifecycle/LiveData` which allows you to observe the `https://developer.android.com/reference/androidx/fragment/app/Fragment#getViewLifecycleOwner()`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/lifecycle/ViewModelStore` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#getViewModelStore()()` Returns the `https://developer.android.com/reference/androidx/lifecycle/ViewModelStore` associated with this Fragment |
| `final int` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#hashCode()()` Subclasses can not override hashCode(). |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/fragment/app/Fragment` | `[instantiate](https://developer.android.com/reference/androidx/fragment/app/Fragment#instantiate(android.content.Context,java.lang.String))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html fname)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#getFragmentFactory()` and `https://developer.android.com/reference/androidx/fragment/app/FragmentFactory#instantiate(java.lang.ClassLoader,java.lang.String)` <br /> |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/fragment/app/Fragment` | `[instantiate](https://developer.android.com/reference/androidx/fragment/app/Fragment#instantiate(android.content.Context,java.lang.String,android.os.Bundle))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html fname, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html args )` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#getFragmentFactory()` and `https://developer.android.com/reference/androidx/fragment/app/FragmentFactory#instantiate(java.lang.ClassLoader,java.lang.String)`, manually calling `https://developer.android.com/reference/androidx/fragment/app/Fragment#setArguments(android.os.Bundle)` on the returned Fragment. <br /> |
| `final boolean` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#isAdded()()` Return true if the fragment is currently added to its activity. |
| `final boolean` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#isDetached()()` Return true if the fragment has been explicitly detached from the UI. |
| `final boolean` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#isHidden()()` Return true if the fragment has been hidden. |
| `final boolean` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#isInLayout()()` Return true if the layout is included as part of an activity view hierarchy via the tag. |
| `final boolean` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#isRemoving()()` Return true if this fragment is currently being removed from its activity. |
| `final boolean` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#isResumed()()` Return true if the fragment is in the resumed state. |
| `final boolean` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#isStateSaved()()` Returns true if this fragment is added and its state has already been saved by its host. |
| `final boolean` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#isVisible()()` Return true if the fragment is currently visible to the user. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread @https://developer.android.com/reference/androidx/annotation/CallSuper [onActivityCreated](https://developer.android.com/reference/androidx/fragment/app/Fragment#onActivityCreated(android.os.Bundle))(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html savedInstanceState)` **This method is deprecated.** use `https://developer.android.com/reference/androidx/fragment/app/Fragment#onViewCreated(android.view.View,android.os.Bundle)` for code touching the view created by `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)` and `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreate(android.os.Bundle)` for other initialization. <br /> |
| `void` | `[onActivityResult](https://developer.android.com/reference/androidx/fragment/app/Fragment#onActivityResult(int,int,android.content.Intent))(int requestCode, int resultCode, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/Intent.html data)` **This method is deprecated.** This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment. <br /> |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread @https://developer.android.com/reference/androidx/annotation/CallSuper [onAttach](https://developer.android.com/reference/androidx/fragment/app/Fragment#onAttach(android.app.Activity))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/Activity.html activity)` **This method is deprecated.** See `https://developer.android.com/reference/androidx/fragment/app/Fragment#onAttach(android.content.Context)`. <br /> |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread @https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/fragment/app/Fragment#onAttach(android.content.Context)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context)` Called when a fragment is first attached to its context. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread [onAttachFragment](https://developer.android.com/reference/androidx/fragment/app/Fragment#onAttachFragment(androidx.fragment.app.Fragment))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/fragment/app/Fragment childFragment)` **This method is deprecated.** The responsibility for listening for fragments being attached has been moved to FragmentManager. <br /> |
| `void` | `@https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/fragment/app/Fragment#onConfigurationChanged(android.content.res.Configuration)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/res/Configuration.html newConfig)` |
| `boolean` | `@https://developer.android.com/reference/androidx/annotation/MainThread https://developer.android.com/reference/androidx/fragment/app/Fragment#onContextItemSelected(android.view.MenuItem)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/MenuItem.html item)` This hook is called whenever an item in a context menu is selected. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread @https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreate(android.os.Bundle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html savedInstanceState)` Called to do initial creation of a fragment. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/view/animation/Animation.html` | `@https://developer.android.com/reference/androidx/annotation/MainThread https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateAnimation(int,boolean,int)(int transit, boolean enter, int nextAnim)` Called when a fragment loads an animation. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/animation/Animator.html` | `@https://developer.android.com/reference/androidx/annotation/MainThread https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateAnimator(int,boolean,int)(int transit, boolean enter, int nextAnim)` Called when a fragment loads an animator. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateContextMenu(android.view.ContextMenu,android.view.View,android.view.ContextMenu.ContextMenuInfo)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/ContextMenu.html menu, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html v, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo.html menuInfo )` Called when a context menu for the `view` is about to be shown. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread [onCreateOptionsMenu](https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateOptionsMenu(android.view.Menu,android.view.MenuInflater))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/Menu.html menu, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/MenuInflater.html inflater)` **This method is deprecated.** `https://developer.android.com/reference/androidx/activity/ComponentActivity` now implements `https://developer.android.com/reference/androidx/core/view/MenuHost`, an interface that allows any component, including your activity itself, to add menu items by calling `https://developer.android.com/reference/androidx/activity/ComponentActivity#addMenuProvider(androidx.core.view.MenuProvider)` without forcing all components through this single method override. <br /> |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/view/View.html` | `@https://developer.android.com/reference/androidx/annotation/MainThread https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/LayoutInflater.html inflater, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/view/ViewGroup.html container, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html savedInstanceState )` Called to have the fragment instantiate its user interface view. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread @https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/fragment/app/Fragment#onDestroy()()` Called when the fragment is no longer in use. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread [onDestroyOptionsMenu](https://developer.android.com/reference/androidx/fragment/app/Fragment#onDestroyOptionsMenu())()` **This method is deprecated.** `https://developer.android.com/reference/androidx/activity/ComponentActivity` now implements `https://developer.android.com/reference/androidx/core/view/MenuHost`, an interface that allows any component, including your activity itself, to add menu items by calling `https://developer.android.com/reference/androidx/core/view/MenuHost#addMenuProvider(androidx.core.view.MenuProvider)` without forcing all components through this single method override. <br /> |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread @https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/fragment/app/Fragment#onDestroyView()()` Called when the view previously created by `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)` has been detached from the fragment. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread @https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/fragment/app/Fragment#onDetach()()` Called when the fragment is no longer attached to its activity. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/LayoutInflater.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#onGetLayoutInflater(android.os.Bundle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html savedInstanceState)` Returns the LayoutInflater used to inflate Views of this Fragment. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread https://developer.android.com/reference/androidx/fragment/app/Fragment#onHiddenChanged(boolean)(boolean hidden)` Called when the hidden state (as returned by `https://developer.android.com/reference/androidx/fragment/app/Fragment#isHidden()` of the fragment or another fragment in its hierarchy has changed. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/UiThread @https://developer.android.com/reference/androidx/annotation/CallSuper [onInflate](https://developer.android.com/reference/androidx/fragment/app/Fragment#onInflate(android.app.Activity,android.util.AttributeSet,android.os.Bundle))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/Activity.html activity, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/util/AttributeSet.html attrs, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html savedInstanceState )` **This method is deprecated.** See `https://developer.android.com/reference/androidx/fragment/app/Fragment#onInflate(android.content.Context,android.util.AttributeSet,android.os.Bundle)`. <br /> |
| `void` | `@https://developer.android.com/reference/androidx/annotation/UiThread @https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/fragment/app/Fragment#onInflate(android.content.Context,android.util.AttributeSet,android.os.Bundle)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/util/AttributeSet.html attrs, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html savedInstanceState )` Called when a fragment is being created as part of a view layout inflation, typically from setting the content view of an activity. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread @https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/fragment/app/Fragment#onLowMemory()()` **This method is deprecated.** |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#onMultiWindowModeChanged(boolean)(boolean isInMultiWindowMode)` Called when the Fragment's activity changes from fullscreen mode to multi-window mode and visa-versa. |
| `boolean` | `@https://developer.android.com/reference/androidx/annotation/MainThread [onOptionsItemSelected](https://developer.android.com/reference/androidx/fragment/app/Fragment#onOptionsItemSelected(android.view.MenuItem))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/MenuItem.html item)` **This method is deprecated.** `https://developer.android.com/reference/androidx/activity/ComponentActivity` now implements `https://developer.android.com/reference/androidx/core/view/MenuHost`, an interface that allows any component, including your activity itself, to add menu items by calling `https://developer.android.com/reference/androidx/core/view/MenuHost#addMenuProvider(androidx.core.view.MenuProvider)` without forcing all components through this single method override. <br /> |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread [onOptionsMenuClosed](https://developer.android.com/reference/androidx/fragment/app/Fragment#onOptionsMenuClosed(android.view.Menu))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/Menu.html menu)` **This method is deprecated.** `https://developer.android.com/reference/androidx/activity/ComponentActivity` now implements `https://developer.android.com/reference/androidx/core/view/MenuHost`, an interface that allows any component, including your activity itself, to add menu items by calling `https://developer.android.com/reference/androidx/core/view/MenuHost#addMenuProvider(androidx.core.view.MenuProvider)` without forcing all components through this single method override. <br /> |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread @https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/fragment/app/Fragment#onPause()()` Called when the Fragment is no longer resumed. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#onPictureInPictureModeChanged(boolean)(boolean isInPictureInPictureMode)` Called by the system when the activity changes to and from picture-in-picture mode. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread [onPrepareOptionsMenu](https://developer.android.com/reference/androidx/fragment/app/Fragment#onPrepareOptionsMenu(android.view.Menu))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/Menu.html menu)` **This method is deprecated.** `https://developer.android.com/reference/androidx/activity/ComponentActivity` now implements `https://developer.android.com/reference/androidx/core/view/MenuHost`, an interface that allows any component, including your activity itself, to add menu items by calling `https://developer.android.com/reference/androidx/core/view/MenuHost#addMenuProvider(androidx.core.view.MenuProvider)` without forcing all components through this single method override. <br /> |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread https://developer.android.com/reference/androidx/fragment/app/Fragment#onPrimaryNavigationFragmentChanged(boolean)( boolean isPrimaryNavigationFragment )` Callback for when the primary navigation state of this Fragment has changed. |
| `void` | `[onRequestPermissionsResult](https://developer.android.com/reference/androidx/fragment/app/Fragment#onRequestPermissionsResult(int,java.lang.String[],int[]))( int requestCode, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html String[] permissions, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html int[] grantResults )` **This method is deprecated.** This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment. <br /> |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread @https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/fragment/app/Fragment#onResume()()` Called when the fragment is visible to the user and actively running. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread https://developer.android.com/reference/androidx/fragment/app/Fragment#onSaveInstanceState(android.os.Bundle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html outState)` Called to ask the fragment to save its current dynamic state, so it can later be reconstructed in a new instance if its process is restarted. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread @https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/fragment/app/Fragment#onStart()()` Called when the Fragment is visible to the user. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread @https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/fragment/app/Fragment#onStop()()` Called when the Fragment is no longer started. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread https://developer.android.com/reference/androidx/fragment/app/Fragment#onViewCreated(android.view.View,android.os.Bundle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html view, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html savedInstanceState)` Called immediately after `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)` has returned, but before any saved state has been restored in to the view. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread @https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/fragment/app/Fragment#onViewStateRestored(android.os.Bundle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html savedInstanceState)` Called when all saved state has been restored into the view hierarchy of the fragment. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/Context.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#peekAvailableContext()()` Get the `https://developer.android.com/reference/android/content/Context.html` if it is currently available. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#postponeEnterTransition()()` Postpone the entering Fragment transition until `https://developer.android.com/reference/androidx/fragment/app/Fragment#startPostponedEnterTransition()` or `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#executePendingTransactions()` has been called. |
| `final void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#postponeEnterTransition(long,java.util.concurrent.TimeUnit)(long duration, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/TimeUnit.html timeUnit)` Postpone the entering Fragment transition for a given amount of time and then call `https://developer.android.com/reference/androidx/fragment/app/Fragment#startPostponedEnterTransition()`. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/activity/result/ActivityResultLauncher<I>` | `@https://developer.android.com/reference/androidx/annotation/MainThread <I, O> https://developer.android.com/reference/androidx/fragment/app/Fragment#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract<I,O>,androidx.activity.result.ActivityResultCallback<O>)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract<I, O> contract, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/activity/result/ActivityResultCallback<O> callback )` Register a request to `https://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)`, designated by the given `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract`. <br /> |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/activity/result/ActivityResultLauncher<I>` | `@https://developer.android.com/reference/androidx/annotation/MainThread <I, O> https://developer.android.com/reference/androidx/fragment/app/Fragment#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract<I,O>,androidx.activity.result.ActivityResultRegistry,androidx.activity.result.ActivityResultCallback<O>)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract<I, O> contract, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/activity/result/ActivityResultRegistry registry, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/activity/result/ActivityResultCallback<O> callback )` Register a request to `https://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)`, designated by the given `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract`. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#registerForContextMenu(android.view.View)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html view)` Registers a context menu to be shown for the given view (multiple views can show the context menu). |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#removeOnContextAvailableListener(androidx.activity.contextaware.OnContextAvailableListener)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/activity/contextaware/OnContextAvailableListener listener )` Remove a `https://developer.android.com/reference/androidx/activity/contextaware/OnContextAvailableListener` previously added via `https://developer.android.com/reference/androidx/activity/contextaware/ContextAware#addOnContextAvailableListener(androidx.activity.contextaware.OnContextAvailableListener)`. |
| `final void` | `[requestPermissions](https://developer.android.com/reference/androidx/fragment/app/Fragment#requestPermissions(java.lang.String[],int))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html String[] permissions, int requestCode)` **This method is deprecated.** This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment. <br /> |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/fragment/app/FragmentActivity` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#requireActivity()()` Return the `https://developer.android.com/reference/androidx/fragment/app/FragmentActivity` this fragment is currently associated with. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#requireArguments()()` Return the arguments supplied when the fragment was instantiated. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#requireContext()()` Return the `https://developer.android.com/reference/android/content/Context.html` this fragment is currently associated with. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/fragment/app/FragmentManager` | `[requireFragmentManager](https://developer.android.com/reference/androidx/fragment/app/Fragment#requireFragmentManager())()` **This method is deprecated.** This has been renamed to `getParentFragmentManager()` to make it clear that you are accessing the FragmentManager that contains this Fragment and not the FragmentManager associated with child Fragments. <br /> |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Object.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#requireHost()()` Return the host object of this fragment. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/fragment/app/Fragment` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#requireParentFragment()()` Returns the parent Fragment containing this Fragment. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#requireView()()` Get the root view for the fragment's layout (the one returned by `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`). |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#setAllowEnterTransitionOverlap(boolean)(boolean allow)` Sets whether the the exit transition and enter transition overlap or not. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#setAllowReturnTransitionOverlap(boolean)(boolean allow)` Sets whether the the return transition and reenter transition overlap or not. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#setArguments(android.os.Bundle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html args)` Supply the construction arguments for this fragment. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#setEnterSharedElementCallback(androidx.core.app.SharedElementCallback)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/app/SharedElementCallback callback)` 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. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#setEnterTransition(java.lang.Object)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html transition)` Sets the Transition that will be used to move Views into the initial scene. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#setExitSharedElementCallback(androidx.core.app.SharedElementCallback)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/app/SharedElementCallback callback)` 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. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#setExitTransition(java.lang.Object)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html transition)` 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. |
| `void` | `[setHasOptionsMenu](https://developer.android.com/reference/androidx/fragment/app/Fragment#setHasOptionsMenu(boolean))(boolean hasMenu)` **This method is deprecated.** This method is no longer needed when using a `https://developer.android.com/reference/androidx/core/view/MenuProvider` to provide a `https://developer.android.com/reference/android/view/Menu.html` to your activity, which replaces `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateOptionsMenu(android.view.Menu,android.view.MenuInflater)` as the recommended way to provide a consistent, optionally `https://developer.android.com/reference/androidx/lifecycle/Lifecycle`-aware, and modular way to handle menu creation and item selection. <br /> |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#setInitialSavedState(androidx.fragment.app.Fragment.SavedState)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/fragment/app/Fragment.SavedState state)` Set the initial saved state that this Fragment should restore itself from when first being constructed, as returned by `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#saveFragmentInstanceState(androidx.fragment.app.Fragment)`. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#setMenuVisibility(boolean)(boolean menuVisible)` Set a hint for whether this fragment's menu should be visible. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#setReenterTransition(java.lang.Object)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html transition)` Sets the Transition that will be used to move Views in to the scene when returning due to popping a back stack. |
| `void` | `[setRetainInstance](https://developer.android.com/reference/androidx/fragment/app/Fragment#setRetainInstance(boolean))(boolean retain)` **This method is deprecated.** Instead of retaining the Fragment itself, use a non-retained Fragment and keep retained state in a ViewModel attached to that Fragment. <br /> |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#setReturnTransition(java.lang.Object)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html transition)` 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. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#setSharedElementEnterTransition(java.lang.Object)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html transition)` Sets the Transition that will be used for shared elements transferred into the content Scene. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#setSharedElementReturnTransition(java.lang.Object)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html transition)` Sets the Transition that will be used for shared elements transferred back during a pop of the back stack. |
| `void` | `[setTargetFragment](https://developer.android.com/reference/androidx/fragment/app/Fragment#setTargetFragment(androidx.fragment.app.Fragment,int))(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/fragment/app/Fragment fragment, int requestCode)` **This method is deprecated.** Instead of using a target fragment to pass results, the fragment requesting a result should use `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)` to register a `https://developer.android.com/reference/androidx/fragment/app/FragmentResultListener` with a ` requestKey` using its `https://developer.android.com/reference/androidx/fragment/app/Fragment#getParentFragmentManager()`. <br /> |
| `void` | `[setUserVisibleHint](https://developer.android.com/reference/androidx/fragment/app/Fragment#setUserVisibleHint(boolean))(boolean isVisibleToUser)` **This method is deprecated.** If you are manually calling this method, use `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#setMaxLifecycle(androidx.fragment.app.Fragment,androidx.lifecycle.Lifecycle.State)` instead. <br /> |
| `boolean` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#shouldShowRequestPermissionRationale(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html permission)` Gets whether you should show UI with rationale before requesting a permission. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#startActivity(android.content.Intent)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent)` Call `https://developer.android.com/reference/android/app/Activity.html#startActivity(android.content.Intent)` from the fragment's containing Activity. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#startActivity(android.content.Intent,android.os.Bundle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html options)` Call `https://developer.android.com/reference/android/app/Activity.html#startActivity(android.content.Intent, android.os.Bundle)` from the fragment's containing Activity. |
| `void` | `[startActivityForResult](https://developer.android.com/reference/androidx/fragment/app/Fragment#startActivityForResult(android.content.Intent,int))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent, int requestCode)` **This method is deprecated.** This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment. <br /> |
| `void` | `[startActivityForResult](https://developer.android.com/reference/androidx/fragment/app/Fragment#startActivityForResult(android.content.Intent,int,android.os.Bundle))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent, int requestCode, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html options )` **This method is deprecated.** This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment. <br /> |
| `void` | `[startIntentSenderForResult](https://developer.android.com/reference/androidx/fragment/app/Fragment#startIntentSenderForResult(android.content.IntentSender,int,android.content.Intent,int,int,int,android.os.Bundle))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/IntentSender.html intent, int requestCode, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/Intent.html fillInIntent, int flagsMask, int flagsValues, int extraFlags, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html options )` **This method is deprecated.** This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment. <br /> |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#startPostponedEnterTransition()()` Begin postponed transitions after `https://developer.android.com/reference/androidx/fragment/app/Fragment#postponeEnterTransition()` was called. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#toString()()` |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/Fragment#unregisterForContextMenu(android.view.View)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html view)` Prevents a context menu to be shown for the given view. |

| ### Extension functions |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/biometric/AuthenticationResultLauncher` | `https://developer.android.com/reference/androidx/fragment/app/AuthenticationUtils.https://developer.android.com/reference/androidx/fragment/app/Fragment#(androidx.fragment.app.Fragment).registerForAuthenticationResult(androidx.biometric.AuthenticationResultCallback)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/fragment/app/Fragment receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/biometric/AuthenticationResultCallback resultCallback )` Returns an `https://developer.android.com/reference/androidx/biometric/AuthenticationResultLauncher` that can be used to initiate authentication. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/biometric/AuthenticationResultLauncher` | `https://developer.android.com/reference/androidx/fragment/app/AuthenticationUtils.https://developer.android.com/reference/androidx/fragment/app/Fragment#(androidx.fragment.app.Fragment).registerForAuthenticationResult(java.util.concurrent.Executor,androidx.biometric.AuthenticationResultCallback)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/fragment/app/Fragment receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html callbackExecutor, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/biometric/AuthenticationResultCallback resultCallback )` Returns an `https://developer.android.com/reference/androidx/biometric/AuthenticationResultLauncher` that can be used to initiate authentication. |
| `final void` | `https://developer.android.com/reference/androidx/fragment/app/FragmentKt.https://developer.android.com/reference/androidx/fragment/app/Fragment#(androidx.fragment.app.Fragment).clearFragmentResult(kotlin.String)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/fragment/app/Fragment receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html requestKey )` Clears the stored result for the given requestKey. |
| `final void` | `https://developer.android.com/reference/androidx/fragment/app/FragmentKt.https://developer.android.com/reference/androidx/fragment/app/Fragment#(androidx.fragment.app.Fragment).clearFragmentResultListener(kotlin.String)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/fragment/app/Fragment receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html requestKey )` Clears the stored `https://developer.android.com/reference/androidx/fragment/app/FragmentResultListener` for the given requestKey. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavController` | `https://developer.android.com/reference/androidx/fragment/app/FragmentKt.https://developer.android.com/reference/androidx/fragment/app/Fragment#(androidx.fragment.app.Fragment).findNavController()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/fragment/app/Fragment receiver)` Find a `https://developer.android.com/reference/androidx/navigation/NavController` given a `https://developer.android.com/reference/androidx/fragment/app/Fragment` |
| `final void` | `https://developer.android.com/reference/androidx/fragment/app/FragmentKt.https://developer.android.com/reference/androidx/fragment/app/Fragment#(androidx.fragment.app.Fragment).setFragmentResult(kotlin.String,android.os.Bundle)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/fragment/app/Fragment receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html requestKey, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html result )` Sets the given result for the `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).setFragmentResult(kotlin.String,android.os.Bundle)`. |
| `final void` | `https://developer.android.com/reference/androidx/fragment/app/FragmentKt.https://developer.android.com/reference/androidx/fragment/app/Fragment#(androidx.fragment.app.Fragment).setFragmentResultListener(kotlin.String,kotlin.Function2)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/fragment/app/Fragment receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html requestKey, @https://developer.android.com/reference/androidx/annotation/NonNull Function2<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> listener )` Sets the `https://developer.android.com/reference/androidx/fragment/app/FragmentResultListener` for a given `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).setFragmentResultListener(kotlin.String,kotlin.Function2)`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavArgsLazy<@https://developer.android.com/reference/androidx/annotation/NonNull Args>` | `@https://developer.android.com/reference/androidx/annotation/MainThread <Args extends https://developer.android.com/reference/androidx/navigation/NavArgs> https://developer.android.com/reference/androidx/fragment/app/FragmentNavArgsLazyKt.https://developer.android.com/reference/androidx/fragment/app/Fragment#(androidx.fragment.app.Fragment).navArgs()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/fragment/app/Fragment receiver)` Returns a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-lazy/index.html` delegate to access the Fragment's arguments as an `https://developer.android.com/reference/androidx/navigation/fragment/package-summary#(androidx.fragment.app.Fragment).navArgs()` instance. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-lazy/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull VM>` | `@https://developer.android.com/reference/androidx/annotation/MainThread <VM extends https://developer.android.com/reference/androidx/lifecycle/ViewModel> https://developer.android.com/reference/androidx/fragment/app/FragmentViewModelLazyKt.https://developer.android.com/reference/androidx/fragment/app/Fragment#(androidx.fragment.app.Fragment).activityViewModels(kotlin.Function0,kotlin.Function0)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/fragment/app/Fragment receiver, Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras> extrasProducer, Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory> factoryProducer )` Returns a property delegate to access parent activity's `https://developer.android.com/reference/androidx/lifecycle/ViewModel`, if `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).activityViewModels(kotlin.Function0,kotlin.Function0)` is specified then `https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory` returned by it will be used to create `https://developer.android.com/reference/androidx/lifecycle/ViewModel` first time. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-lazy/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull VM>` | `@https://developer.android.com/reference/androidx/annotation/MainThread <VM extends https://developer.android.com/reference/androidx/lifecycle/ViewModel> https://developer.android.com/reference/androidx/fragment/app/FragmentViewModelLazyKt.https://developer.android.com/reference/androidx/fragment/app/Fragment#(androidx.fragment.app.Fragment).createViewModelLazy(kotlin.reflect.KClass,kotlin.Function0,kotlin.Function0,kotlin.Function0)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/fragment/app/Fragment receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull VM> viewModelClass, @https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/ViewModelStore> storeProducer, @https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras> extrasProducer, Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory> factoryProducer )` Helper method for creation of `https://developer.android.com/reference/androidx/lifecycle/ViewModelLazy`, that resolves `null` passed as `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).createViewModelLazy(kotlin.reflect.KClass,kotlin.Function0,kotlin.Function0,kotlin.Function0)` to the default factory. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-lazy/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull VM>` | `@https://developer.android.com/reference/androidx/annotation/MainThread <VM extends https://developer.android.com/reference/androidx/lifecycle/ViewModel> https://developer.android.com/reference/androidx/fragment/app/FragmentViewModelLazyKt.https://developer.android.com/reference/androidx/fragment/app/Fragment#(androidx.fragment.app.Fragment).viewModels(kotlin.Function0,kotlin.Function0,kotlin.Function0)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/fragment/app/Fragment receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/ViewModelStoreOwner> ownerProducer, Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras> extrasProducer, Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory> factoryProducer )` Returns a property delegate to access `https://developer.android.com/reference/androidx/lifecycle/ViewModel` by **default** scoped to this `https://developer.android.com/reference/androidx/fragment/app/Fragment`: |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-lazy/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull VM>` | `@https://developer.android.com/reference/androidx/annotation/MainThread <VM extends https://developer.android.com/reference/androidx/lifecycle/ViewModel> https://developer.android.com/reference/androidx/fragment/app/HiltNavGraphViewModelLazyKt.https://developer.android.com/reference/androidx/fragment/app/Fragment#(androidx.fragment.app.Fragment).hiltNavGraphViewModels(kotlin.Int)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/fragment/app/Fragment receiver, @https://developer.android.com/reference/androidx/annotation/IdRes int navGraphId )` Returns a property delegate to access a [HiltViewModel](https://dagger.dev/api/latest/dagger/hilt/android/lifecycle/HiltViewModel) -annotated `https://developer.android.com/reference/androidx/lifecycle/ViewModel` scoped to a navigation graph present on the `https://developer.android.com/reference/androidx/navigation/NavController` back stack: |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-lazy/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull VM>` | `@https://developer.android.com/reference/androidx/annotation/MainThread <VM extends https://developer.android.com/reference/androidx/lifecycle/ViewModel, VMF extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/fragment/app/HiltNavGraphViewModelLazyKt.https://developer.android.com/reference/androidx/fragment/app/Fragment#(androidx.fragment.app.Fragment).hiltNavGraphViewModels(kotlin.Int,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/fragment/app/Fragment receiver, @https://developer.android.com/reference/androidx/annotation/IdRes int navGraphId, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull VMF, @https://developer.android.com/reference/androidx/annotation/NonNull VM> creationCallback )` Returns a property delegate to access a [HiltViewModel](https://dagger.dev/api/latest/dagger/hilt/android/lifecycle/HiltViewModel) -annotated `https://developer.android.com/reference/androidx/lifecycle/ViewModel` with an @AssistedInject-annotated constructor that is scoped to a navigation graph present on the `https://developer.android.com/reference/androidx/navigation/NavController` back stack: |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-lazy/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull VM>` | `@https://developer.android.com/reference/androidx/annotation/MainThread <VM extends https://developer.android.com/reference/androidx/lifecycle/ViewModel> https://developer.android.com/reference/androidx/fragment/app/NavGraphViewModelLazyKt.https://developer.android.com/reference/androidx/fragment/app/Fragment#(androidx.fragment.app.Fragment).navGraphViewModels(kotlin.Int,kotlin.Function0,kotlin.Function0)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/fragment/app/Fragment receiver, @https://developer.android.com/reference/androidx/annotation/IdRes int navGraphId, Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras> extrasProducer, Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory> factoryProducer )` Returns a property delegate to access a `https://developer.android.com/reference/androidx/lifecycle/ViewModel` scoped to a navigation graph present on the `https://developer.android.com/reference/androidx/navigation/NavController` back stack: |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-lazy/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull VM>` | `@https://developer.android.com/reference/androidx/annotation/MainThread <VM extends https://developer.android.com/reference/androidx/lifecycle/ViewModel> https://developer.android.com/reference/androidx/fragment/app/NavGraphViewModelLazyKt.https://developer.android.com/reference/androidx/fragment/app/Fragment#(androidx.fragment.app.Fragment).navGraphViewModels(kotlin.String,kotlin.Function0,kotlin.Function0)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/fragment/app/Fragment receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html navGraphRoute, Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras> extrasProducer, Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory> factoryProducer )` Returns a property delegate to access a `https://developer.android.com/reference/androidx/lifecycle/ViewModel` scoped to a navigation graph present on the `https://developer.android.com/reference/androidx/navigation/NavController` back stack: |

## Public constructors

### Fragment

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public Fragment()
```

Constructor used by the default `https://developer.android.com/reference/androidx/fragment/app/FragmentFactory`. You must `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#setFragmentFactory(androidx.fragment.app.FragmentFactory)` if you want to use a non-default constructor to ensure that your constructor is called when the fragment is re-instantiated.

It is strongly recommended to supply arguments with `https://developer.android.com/reference/androidx/fragment/app/Fragment#setArguments(android.os.Bundle)` and later retrieved by the Fragment with `https://developer.android.com/reference/androidx/fragment/app/Fragment#getArguments()`. These arguments are automatically saved and restored alongside the Fragment.

Applications should generally not implement a constructor. Prefer `https://developer.android.com/reference/androidx/fragment/app/Fragment#onAttach(android.content.Context)` instead. It is the first place application code can run where the fragment is ready to be used - the point where the fragment is actually associated with its context. Some applications may also want to implement `https://developer.android.com/reference/androidx/fragment/app/Fragment#onInflate(android.content.Context,android.util.AttributeSet,android.os.Bundle)` to retrieve attributes from a layout resource, although note this happens when the fragment is attached.

### Fragment

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@ContentView
public Fragment(@LayoutRes int contentLayoutId)
```

Alternate constructor that can be called from your default, no argument constructor to provide a default layout that will be inflated by `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`.

```
class MyFragment extends Fragment {
  public MyFragment() {
    super(R.layout.fragment_main);
  }
}
```
You must `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#setFragmentFactory(androidx.fragment.app.FragmentFactory)` if you want to use a non-default constructor to ensure that your constructor is called when the fragment is re-instantiated.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#Fragment()` |   |
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)` |   |

## Public methods

### addOnContextAvailableListener

Added in [1.9.1](https://developer.android.com/jetpack/androidx/releases/fragment#1.9.1)

```
public void addOnContextAvailableListener(
    @NonNull OnContextAvailableListener listener
)
```

Add a new `https://developer.android.com/reference/androidx/activity/contextaware/OnContextAvailableListener` for receiving a callback for when this class is associated with a `https://developer.android.com/reference/android/content/Context.html`.

Listeners are triggered in the order they are added when added before the Context is available. Listeners added after the context has been made available will have the Context synchronously delivered to them as part of this call.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/activity/contextaware/OnContextAvailableListener listener` | The listener that should be added. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/activity/contextaware/ContextAware#removeOnContextAvailableListener(androidx.activity.contextaware.OnContextAvailableListener)` |   |

### dump

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void dump(
    @NonNull String prefix,
    @Nullable FileDescriptor fd,
    @NonNull PrintWriter writer,
    @Nullable String[] args
)
```

Print the Fragments's state into the given stream.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html prefix` | Text to print at the front of each line. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/io/FileDescriptor.html fd` | The raw file descriptor that the dump is being sent to. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/io/PrintWriter.html writer` | The PrintWriter to which you should dump your state. This will be closed for you after you return. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html String[] args` | additional arguments to the dump request. |

### equals

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final boolean equals(@Nullable Object o)
```

Subclasses can not override equals().

### getActivity

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final @Nullable FragmentActivity getActivity()
```

Return the `https://developer.android.com/reference/androidx/fragment/app/FragmentActivity` this fragment is currently associated with. May return `null` if the fragment is associated with a `https://developer.android.com/reference/android/content/Context.html` instead.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#requireActivity()` |   |

### getAllowEnterTransitionOverlap

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public boolean getAllowEnterTransitionOverlap()
```

Returns whether the the exit transition and enter transition overlap or not. When true, the enter transition will start as soon as possible. When false, the enter transition will wait until the exit transition completes before starting.

| Returns |
|---|---|
| `boolean` | true when the enter transition should start as soon as possible or false to when it should wait until the exiting transition completes. |

### getAllowReturnTransitionOverlap

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public boolean getAllowReturnTransitionOverlap()
```

Returns whether the the return transition and reenter transition overlap or not. When true, the reenter transition will start as soon as possible. When false, the reenter transition will wait until the return transition completes before starting.

| Returns |
|---|---|
| `boolean` | true to start the reenter transition when possible or false to wait until the return transition completes. |

### getArguments

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final @Nullable Bundle getArguments()
```

Return the arguments supplied when the fragment was instantiated, if any.

### getChildFragmentManager

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final @NonNull FragmentManager getChildFragmentManager()
```

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

### getContext

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public @Nullable Context getContext()
```

Return the `https://developer.android.com/reference/android/content/Context.html` this fragment is currently associated with.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#requireContext()` |   |

### getDefaultViewModelCreationExtras

```
@CallSuper
public @NonNull CreationExtras getDefaultViewModelCreationExtras()
```

The default `https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras` to pass into `https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory#create(kotlin.reflect.KClass,androidx.lifecycle.viewmodel.CreationExtras)` when no overriding `https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras` are provided.

The `https://developer.android.com/reference/androidx/fragment/app/Fragment#getArguments()` when this is first called will be used as the defaults to any `https://developer.android.com/reference/androidx/lifecycle/SavedStateHandle` passed to a view model created using this extra.

### getDefaultViewModelProviderFactory

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.2.0)

```
public @NonNull ViewModelProvider.Factory getDefaultViewModelProviderFactory()
```

The default `https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory` to use when no custom `https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory` is provided to the `https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider`.

### getEnterTransition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public @Nullable Object getEnterTransition()
```

Returns the Transition that will be used to move Views into the initial scene. The entering Views will be those that are regular Views or ViewGroups that have `https://developer.android.com/reference/android/view/ViewGroup.html#isTransitionGroup()` return true. Typical Transitions will extend `https://developer.android.com/reference/android/transition/Visibility.html` as entering is governed by changing visibility from `https://developer.android.com/reference/android/view/View.html#INVISIBLE` to `https://developer.android.com/reference/android/view/View.html#VISIBLE`.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html` | the Transition to use to move Views into the initial Scene. |

### getExitTransition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public @Nullable Object getExitTransition()
```

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. The exiting Views will be those that are regular Views or ViewGroups that have `https://developer.android.com/reference/android/view/ViewGroup.html#isTransitionGroup()` return true. Typical Transitions will extend `https://developer.android.com/reference/android/transition/Visibility.html` as exiting is governed by changing visibility from `https://developer.android.com/reference/android/view/View.html#VISIBLE` to `https://developer.android.com/reference/android/view/View.html#INVISIBLE`. If transition is null, the views will remain unaffected.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html` | the Transition to use to move Views out of the Scene when the Fragment is being closed not due to popping the back stack. |

### getFragmentManager

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.2.0)

```
public final @Nullable FragmentManager [getFragmentManager](https://developer.android.com/reference/androidx/fragment/app/Fragment#getFragmentManager())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> This has been removed in favor of `getParentFragmentManager()` which throws an `https://developer.android.com/reference/java/lang/IllegalStateException.html` if the FragmentManager is null. Check if `https://developer.android.com/reference/androidx/fragment/app/Fragment#isAdded()` returns `false` to determine if the FragmentManager is `null`.

Return the FragmentManager for interacting with fragments associated with this fragment's activity. Note that this will be non-null slightly before `https://developer.android.com/reference/androidx/fragment/app/Fragment#getActivity()`, during the time from when the fragment is placed in a `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction` until it is committed and attached to its activity.

If this Fragment is a child of another Fragment, the FragmentManager returned here will be the parent's `https://developer.android.com/reference/androidx/fragment/app/Fragment#getChildFragmentManager()`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#getParentFragmentManager()` |   |

### getHost

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final @Nullable Object getHost()
```

Return the host object of this fragment. May return `null` if the fragment isn't currently being hosted.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#requireHost()` |   |

### getId

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final int getId()
```

Return the identifier this fragment is known by. This is either the android:id value supplied in a layout or the container view ID supplied when adding the fragment.

### getLayoutInflater

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final @NonNull LayoutInflater getLayoutInflater()
```

Returns the cached LayoutInflater used to inflate Views of this Fragment. If `https://developer.android.com/reference/androidx/fragment/app/Fragment#onGetLayoutInflater(android.os.Bundle)` has not been called `https://developer.android.com/reference/androidx/fragment/app/Fragment#onGetLayoutInflater(android.os.Bundle)` will be called with a `null` argument and that value will be cached.

The cached LayoutInflater will be replaced immediately prior to `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)` and cleared immediately after `https://developer.android.com/reference/androidx/fragment/app/Fragment#onDetach()`.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/LayoutInflater.html` | The LayoutInflater used to inflate Views of this Fragment. |

### getLifecycle

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public @NonNull Lifecycle getLifecycle()
```

The `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` of this owner.

Overriding this method is no longer supported and this method will be made `final` in a future version of Fragment.

### getLoaderManager

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public @NonNull LoaderManager [getLoaderManager](https://developer.android.com/reference/androidx/fragment/app/Fragment#getLoaderManager())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/loader/app/LoaderManager#getInstance(T)`.

Return the LoaderManager for this fragment.

### getParentFragment

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final @Nullable Fragment getParentFragment()
```

Returns the parent Fragment containing this Fragment. If this Fragment is attached directly to an Activity, returns null.

### getParentFragmentManager

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.2.0)

```
public final @NonNull FragmentManager getParentFragmentManager()
```

Return the FragmentManager for interacting with fragments associated with this fragment's activity. Note that this will be available slightly before `https://developer.android.com/reference/androidx/fragment/app/Fragment#getActivity()`, during the time from when the fragment is placed in a `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction` until it is committed and attached to its activity.

If this Fragment is a child of another Fragment, the FragmentManager returned here will be the parent's `https://developer.android.com/reference/androidx/fragment/app/Fragment#getChildFragmentManager()`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if not associated with a transaction or host. |

### getReenterTransition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public @Nullable Object getReenterTransition()
```

Returns the Transition that will be used to move Views in to the scene when returning due to popping a back stack. The entering Views will be those that are regular Views or ViewGroups that have `https://developer.android.com/reference/android/view/ViewGroup.html#isTransitionGroup()` return true. Typical Transitions will extend `https://developer.android.com/reference/android/transition/Visibility.html` as exiting is governed by changing visibility from `https://developer.android.com/reference/android/view/View.html#VISIBLE` to `https://developer.android.com/reference/android/view/View.html#INVISIBLE`. If nothing is set, the default will be to use the same transition as `https://developer.android.com/reference/androidx/fragment/app/Fragment#getExitTransition()`.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html` | the Transition to use to move Views into the scene when reentering from a previously-started Activity due to popping the back stack. |

### getResources

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final @NonNull Resources getResources()
```

Return `requireActivity().getResources()`.

### getRetainInstance

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.3.0)

```
public final boolean [getRetainInstance](https://developer.android.com/reference/androidx/fragment/app/Fragment#getRetainInstance())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Instead of retaining the Fragment itself, use a non-retained Fragment and keep retained state in a ViewModel attached to that Fragment. The ViewModel's constructor and its onCleared() callback provide the signal for initial creation and final destruction of the retained state.

Returns `true` if this fragment instance's state will be retained across configuration changes, and `false` if it will not.

| Returns |
|---|---|
| `boolean` | whether or not this fragment instance will be retained. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#setRetainInstance(boolean)` |   |

### getReturnTransition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public @Nullable Object getReturnTransition()
```

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. The exiting Views will be those that are regular Views or ViewGroups that have `https://developer.android.com/reference/android/view/ViewGroup.html#isTransitionGroup()` return true. Typical Transitions will extend `https://developer.android.com/reference/android/transition/Visibility.html` as entering is governed by changing visibility from `https://developer.android.com/reference/android/view/View.html#VISIBLE` to `https://developer.android.com/reference/android/view/View.html#INVISIBLE`. If nothing is set, the default will be to use the same transition as `https://developer.android.com/reference/androidx/fragment/app/Fragment#getEnterTransition()`.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html` | the Transition to use to move Views out of the Scene when the Fragment is preparing to close due to popping the back stack. |

### getSavedStateRegistry

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final @NonNull SavedStateRegistry getSavedStateRegistry()
```

The `https://developer.android.com/reference/androidx/savedstate/SavedStateRegistry` owned by this `https://developer.android.com/reference/androidx/savedstate/SavedStateRegistryOwner`.

### getSharedElementEnterTransition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public @Nullable Object getSharedElementEnterTransition()
```

Returns the Transition that will be used for shared elements transferred into the content Scene. Typical Transitions will affect size and location, such as `https://developer.android.com/reference/android/transition/ChangeBounds.html`. A null value will cause transferred shared elements to blink to the final position.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html` | The Transition to use for shared elements transferred into the content Scene. |

### getSharedElementReturnTransition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public @Nullable Object getSharedElementReturnTransition()
```

Return the Transition that will be used for shared elements transferred back during a pop of the back stack. This Transition acts in the leaving Fragment. Typical Transitions will affect size and location, such as `https://developer.android.com/reference/android/transition/ChangeBounds.html`. A null value will cause transferred shared elements to blink to the final position. If no value is set, the default will be to use the same value as `https://developer.android.com/reference/androidx/fragment/app/Fragment#setSharedElementEnterTransition(java.lang.Object)`.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html` | The Transition to use for shared elements transferred out of the content Scene. |

### getString

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final @NonNull String getString(@StringRes int resId)
```

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/StringRes int resId` | Resource id for the string |

### getString

```
public final @NonNull String getString(@StringRes int resId, @Nullable Object[] formatArgs)
```

Return a localized formatted string from the application's package's default string table, substituting the format arguments as defined in `https://developer.android.com/reference/java/util/Formatter.html` and `https://developer.android.com/reference/java/lang/String.html#format(java.lang.String, java.lang.Object...)`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/StringRes int resId` | Resource id for the format string |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html Object[] formatArgs` | The format arguments that will be used for substitution. |

### getTag

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final @Nullable String getTag()
```

Get the tag name of the fragment, if specified.

### getTargetFragment

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.3.0)

```
public final @Nullable Fragment [getTargetFragment](https://developer.android.com/reference/androidx/fragment/app/Fragment#getTargetFragment())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Instead of using a target fragment to pass results, use `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#setFragmentResult(java.lang.String,android.os.Bundle)` to deliver results to `https://developer.android.com/reference/androidx/fragment/app/FragmentResultListener` instances registered by other fragments via `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)`.

Return the target fragment set by `https://developer.android.com/reference/androidx/fragment/app/Fragment#setTargetFragment(androidx.fragment.app.Fragment,int)`.

### getTargetRequestCode

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.3.0)

```
public final int [getTargetRequestCode](https://developer.android.com/reference/androidx/fragment/app/Fragment#getTargetRequestCode())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> When using the target fragment replacement of `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)` and `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#setFragmentResult(java.lang.String,android.os.Bundle)`, consider using `https://developer.android.com/reference/androidx/fragment/app/Fragment#setArguments(android.os.Bundle)` to pass a `requestKey` if you need to support dynamic request keys.

Return the target request code set by `https://developer.android.com/reference/androidx/fragment/app/Fragment#setTargetFragment(androidx.fragment.app.Fragment,int)`.

### getText

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final @NonNull CharSequence getText(@StringRes int resId)
```

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/StringRes int resId` | Resource id for the CharSequence text |

### getUserVisibleHint

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public boolean [getUserVisibleHint](https://developer.android.com/reference/androidx/fragment/app/Fragment#getUserVisibleHint())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#setMaxLifecycle(androidx.fragment.app.Fragment,androidx.lifecycle.Lifecycle.State)` instead.

| Returns |
|---|---|
| `boolean` | The current value of the user-visible hint on this fragment. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#setUserVisibleHint(boolean)` |   |

### getView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public @Nullable View getView()
```

Get the root view for the fragment's layout (the one returned by `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`), if provided.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/view/View.html` | The fragment's root view, or null if it has no layout. |

### getViewLifecycleOwner

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
public @NonNull LifecycleOwner getViewLifecycleOwner()
```

Get a `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` that represents the `https://developer.android.com/reference/androidx/fragment/app/Fragment#getView()` lifecycle. In most cases, this mirrors the lifecycle of the Fragment itself, but in cases of `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#detach(androidx.fragment.app.Fragment)` Fragments, the lifecycle of the Fragment can be considerably longer than the lifecycle of the View itself.

Namely, the lifecycle of the Fragment's View is:

1. `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_CREATE` after `https://developer.android.com/reference/androidx/fragment/app/Fragment#onViewStateRestored(android.os.Bundle)`
2. `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_START` after `https://developer.android.com/reference/androidx/fragment/app/Fragment#onStart()`
3. `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_RESUME` after `https://developer.android.com/reference/androidx/fragment/app/Fragment#onResume()`
4. `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_PAUSE` before `https://developer.android.com/reference/androidx/fragment/app/Fragment#onPause()`
5. `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_STOP` before `https://developer.android.com/reference/androidx/fragment/app/Fragment#onStop()`
6. `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.Event#ON_DESTROY` before `https://developer.android.com/reference/androidx/fragment/app/Fragment#onDestroyView()`

The first method where it is safe to access the view lifecycle is `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)` under the condition that you must return a non-null view (an IllegalStateException will be thrown if you access the view lifecycle but don't return a non-null view).

The view lifecycle remains valid through the call to `https://developer.android.com/reference/androidx/fragment/app/Fragment#onDestroyView()`, after which `https://developer.android.com/reference/androidx/fragment/app/Fragment#getView()` will return null, the view lifecycle will be destroyed, and this method will throw an IllegalStateException. Consider using `https://developer.android.com/reference/androidx/fragment/app/Fragment#getViewLifecycleOwnerLiveData()` or `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#runOnCommit(java.lang.Runnable)` to receive a callback for when the Fragment's view lifecycle is available.

This should only be called on the main thread.

Overriding this method is no longer supported and this method will be made `final` in a future version of Fragment.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` | A `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` that represents the `https://developer.android.com/reference/androidx/fragment/app/Fragment#getView()` lifecycle. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if the `https://developer.android.com/reference/androidx/fragment/app/Fragment#getView()`. |

### getViewLifecycleOwnerLiveData

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public @NonNull LiveData<LifecycleOwner> getViewLifecycleOwnerLiveData()
```

Retrieve a `https://developer.android.com/reference/androidx/lifecycle/LiveData` which allows you to observe the `https://developer.android.com/reference/androidx/fragment/app/Fragment#getViewLifecycleOwner()`.

This will be set to the new `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` after `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)` returns a non-null View and will set to null after `https://developer.android.com/reference/androidx/fragment/app/Fragment#onDestroyView()`.

Overriding this method is no longer supported and this method will be made `final` in a future version of Fragment.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/lifecycle/LiveData<https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner>` | A LiveData that changes in sync with `https://developer.android.com/reference/androidx/fragment/app/Fragment#getViewLifecycleOwner()`. |

### getViewModelStore

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public @NonNull ViewModelStore getViewModelStore()
```

Returns the `https://developer.android.com/reference/androidx/lifecycle/ViewModelStore` associated with this Fragment

Overriding this method is no longer supported and this method will be made `final` in a future version of Fragment.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/lifecycle/ViewModelStore` | a `ViewModelStore` |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if called before the Fragment is attached i.e., before onAttach(). |

### hashCode

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final int hashCode()
```

Subclasses can not override hashCode().

### instantiate

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public static @NonNull Fragment [instantiate](https://developer.android.com/reference/androidx/fragment/app/Fragment#instantiate(android.content.Context,java.lang.String))(@NonNull Context context, @NonNull String fname)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#getFragmentFactory()` and `https://developer.android.com/reference/androidx/fragment/app/FragmentFactory#instantiate(java.lang.ClassLoader,java.lang.String)`

Like `https://developer.android.com/reference/androidx/fragment/app/Fragment#instantiate(android.content.Context,java.lang.String,android.os.Bundle)` but with a null argument Bundle.

### instantiate

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public static @NonNull Fragment [instantiate](https://developer.android.com/reference/androidx/fragment/app/Fragment#instantiate(android.content.Context,java.lang.String,android.os.Bundle))(
    @NonNull Context context,
    @NonNull String fname,
    @Nullable Bundle args
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#getFragmentFactory()` and `https://developer.android.com/reference/androidx/fragment/app/FragmentFactory#instantiate(java.lang.ClassLoader,java.lang.String)`, manually calling `https://developer.android.com/reference/androidx/fragment/app/Fragment#setArguments(android.os.Bundle)` on the returned Fragment.

Create a new instance of a Fragment with the given class name. This is the same as calling its empty constructor, setting the `https://developer.android.com/reference/java/lang/ClassLoader.html` on the supplied arguments, then calling `https://developer.android.com/reference/androidx/fragment/app/Fragment#setArguments(android.os.Bundle)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | The calling context being used to instantiate the fragment. This is currently just used to get its ClassLoader. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html fname` | The class name of the fragment to instantiate. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html args` | Bundle of arguments to supply to the fragment, which it can retrieve with `https://developer.android.com/reference/androidx/fragment/app/Fragment#getArguments()`. May be null. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/fragment/app/Fragment` | Returns a new fragment instance. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment.InstantiationException` | If there is a failure in instantiating the given fragment class. This is a runtime exception; it is not normally expected to happen. |

### isAdded

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final boolean isAdded()
```

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

### isDetached

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final boolean isDetached()
```

Return true if the fragment has been explicitly detached from the UI. That is, `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#detach(androidx.fragment.app.Fragment)` has been used on it.

### isHidden

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final boolean isHidden()
```

Return true if the fragment has been hidden. This includes the case if the fragment is hidden because its parent is hidden. By default fragments are shown. You can find out about changes to this state with `https://developer.android.com/reference/androidx/fragment/app/Fragment#onHiddenChanged(boolean)`. Note that the hidden state is orthogonal to other states -- that is, to be visible to the user, a fragment must be both started and not hidden.

### isInLayout

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final boolean isInLayout()
```

Return true if the layout is included as part of an activity view hierarchy via the tag. This will always be true when fragments are created through the tag, *except* in the case where an old fragment is restored from a previous state and it does not appear in the layout of the current state.

### isRemoving

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final boolean isRemoving()
```

Return true if this fragment is currently being removed from its activity. This is *not* whether its activity is finishing, but rather whether it is in the process of being removed from its activity.

### isResumed

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final boolean isResumed()
```

Return true if the fragment is in the resumed state. This is true for the duration of `https://developer.android.com/reference/androidx/fragment/app/Fragment#onResume()` and `https://developer.android.com/reference/androidx/fragment/app/Fragment#onPause()` as well.

### isStateSaved

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final boolean isStateSaved()
```

Returns true if this fragment is added and its state has already been saved by its host. Any operations that would change saved state should not be performed if this method returns true, and some operations such as `https://developer.android.com/reference/androidx/fragment/app/Fragment#setArguments(android.os.Bundle)` will fail.

| Returns |
|---|---|
| `boolean` | true if this fragment's state has already been saved by its host |

### isVisible

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final boolean isVisible()
```

Return true if the fragment is currently visible to the user. This means it: (1) has been added, (2) has its view attached to the window, and (3) is not hidden.

### onActivityCreated

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.3.0)

```
@MainThread
@CallSuper
public void [onActivityCreated](https://developer.android.com/reference/androidx/fragment/app/Fragment#onActivityCreated(android.os.Bundle))(@Nullable Bundle savedInstanceState)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> use `https://developer.android.com/reference/androidx/fragment/app/Fragment#onViewCreated(android.view.View,android.os.Bundle)` for code touching the view created by `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)` and `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreate(android.os.Bundle)` for other initialization. To get a callback specifically when a Fragment activity's `https://developer.android.com/reference/android/app/Activity.html#onCreate(android.os.Bundle)` is called, register a `https://developer.android.com/reference/androidx/lifecycle/LifecycleObserver` on the Activity's `https://developer.android.com/reference/androidx/lifecycle/Lifecycle` in `https://developer.android.com/reference/androidx/fragment/app/Fragment#onAttach(android.content.Context)`, removing it when it receives the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED` callback.

Called when the fragment's activity has been created and this fragment's view hierarchy instantiated. It can be used to do final initialization once these pieces are in place, such as retrieving views or restoring state. It is also useful for fragments that use `https://developer.android.com/reference/androidx/fragment/app/Fragment#setRetainInstance(boolean)` to retain their instance, as this callback tells the fragment when it is fully associated with the new activity instance. This is called after `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)` and before `https://developer.android.com/reference/androidx/fragment/app/Fragment#onViewStateRestored(android.os.Bundle)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html savedInstanceState` | If the fragment is being re-created from a previous saved state, this is the state. |

### onActivityResult

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.3.0)

```
public void [onActivityResult](https://developer.android.com/reference/androidx/fragment/app/Fragment#onActivityResult(int,int,android.content.Intent))(int requestCode, int resultCode, @Nullable Intent data)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment. Use `https://developer.android.com/reference/androidx/fragment/app/Fragment#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract<I,O>,androidx.activity.result.ActivityResultCallback<O>)` with the appropriate `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` and handling the result in the `https://developer.android.com/reference/androidx/activity/result/ActivityResultCallback#onActivityResult(O)`.

Receive the result from a previous call to `https://developer.android.com/reference/androidx/fragment/app/Fragment#startActivityForResult(android.content.Intent,int)`. This follows the related Activity API as described there in `https://developer.android.com/reference/android/app/Activity.html#onActivityResult(int, int, android.content.Intent)`.

| Parameters |
|---|---|
| `int requestCode` | The integer request code originally supplied to startActivityForResult(), allowing you to identify who this result came from. |
| `int resultCode` | The integer result code returned by the child activity through its setResult(). |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/Intent.html data` | An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). |

### onAttach

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
@CallSuper
public void [onAttach](https://developer.android.com/reference/androidx/fragment/app/Fragment#onAttach(android.app.Activity))(@NonNull Activity activity)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> See `https://developer.android.com/reference/androidx/fragment/app/Fragment#onAttach(android.content.Context)`.

Called when a fragment is first attached to its activity. `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreate(android.os.Bundle)` will be called after this.

### onAttach

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
@CallSuper
public void onAttach(@NonNull Context context)
```

Called when a fragment is first attached to its context. `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreate(android.os.Bundle)` will be called after this.

### onAttachFragment

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.3.0)

```
@MainThread
public void [onAttachFragment](https://developer.android.com/reference/androidx/fragment/app/Fragment#onAttachFragment(androidx.fragment.app.Fragment))(@NonNull Fragment childFragment)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> The responsibility for listening for fragments being attached has been moved to FragmentManager. You can add a listener to `https://developer.android.com/reference/androidx/fragment/app/Fragment#getChildFragmentManager()` the child FragmentManager} by calling `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#addFragmentOnAttachListener(androidx.fragment.app.FragmentOnAttachListener)` in `https://developer.android.com/reference/androidx/fragment/app/Fragment#onAttach(android.content.Context)` to get callbacks when a child fragment is attached.

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

This is called after the attached fragment's `onAttach` and before the attached fragment's `onCreate` if the fragment has not yet had a previous call to `onCreate`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/fragment/app/Fragment childFragment` | child fragment being attached |

### onConfigurationChanged

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@CallSuper
public void onConfigurationChanged(@NonNull Configuration newConfig)
```

### onContextItemSelected

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
public boolean onContextItemSelected(@NonNull MenuItem item)
```

This hook is called whenever an item in a context menu is selected. The default implementation simply returns false to have the normal processing happen (calling the item's Runnable or sending a message to its Handler as appropriate). You can use this method for any items for which you would like to do processing without those other facilities.

Use `https://developer.android.com/reference/android/view/MenuItem.html#getMenuInfo()` to get extra information set by the View that added this menu item.

Derived classes should call through to the base class for it to perform the default menu handling.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/MenuItem.html item` | The context menu item that was selected. |

| Returns |
|---|---|
| `boolean` | boolean Return false to allow normal context menu processing to proceed, true to consume it here. |

### onCreate

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
@CallSuper
public void onCreate(@Nullable Bundle savedInstanceState)
```

Called to do initial creation of a fragment. This is called after `https://developer.android.com/reference/androidx/fragment/app/Fragment#onAttach(android.app.Activity)` and before `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`.

Note that this can be called while the fragment's activity is still in the process of being created. As such, you can not rely on things like the activity's content view hierarchy being initialized at this point. If you want to do work once the activity itself is created, add a `https://developer.android.com/reference/androidx/lifecycle/LifecycleObserver` on the activity's Lifecycle, removing it when it receives the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#CREATED` callback.

Any restored child fragments will be created before the base `Fragment.onCreate` method returns.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html savedInstanceState` | If the fragment is being re-created from a previous saved state, this is the state. |

### onCreateAnimation

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
public @Nullable Animation onCreateAnimation(int transit, boolean enter, int nextAnim)
```

Called when a fragment loads an animation. Note that if `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#setCustomAnimations(int,int)` was called with `https://developer.android.com/reference/android/animation/Animator.html` resources instead of `https://developer.android.com/reference/android/view/animation/Animation.html` resources, `nextAnim` will be an animator resource.

| Parameters |
|---|---|
| `int transit` | The value set in `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#setTransition(int)` or 0 if not set. |
| `boolean enter` | `true` when the fragment is added/attached/shown or `false` when the fragment is removed/detached/hidden. |
| `int nextAnim` | The resource set in `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#setCustomAnimations(int,int)`, `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#setCustomAnimations(int,int,int,int)`, or 0 if neither was called. The value will depend on the current operation. |

### onCreateAnimator

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
public @Nullable Animator onCreateAnimator(int transit, boolean enter, int nextAnim)
```

Called when a fragment loads an animator. This will be called when `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateAnimation(int,boolean,int)` returns null. Note that if `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#setCustomAnimations(int,int)` was called with `https://developer.android.com/reference/android/view/animation/Animation.html` resources instead of `https://developer.android.com/reference/android/animation/Animator.html` resources, `nextAnim` will be an animation resource.

| Parameters |
|---|---|
| `int transit` | The value set in `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#setTransition(int)` or 0 if not set. |
| `boolean enter` | `true` when the fragment is added/attached/shown or `false` when the fragment is removed/detached/hidden. |
| `int nextAnim` | The resource set in `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#setCustomAnimations(int,int)`, `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#setCustomAnimations(int,int,int,int)`, or 0 if neither was called. The value will depend on the current operation. |

### onCreateContextMenu

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
public void onCreateContextMenu(
    @NonNull ContextMenu menu,
    @NonNull View v,
    @Nullable ContextMenu.ContextMenuInfo menuInfo
)
```

Called when a context menu for the `view` is about to be shown. Unlike `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateOptionsMenu(android.view.Menu,android.view.MenuInflater)`, this will be called every time the context menu is about to be shown and should be populated for the view (or item inside the view for `https://developer.android.com/reference/android/widget/AdapterView.html` subclasses, this can be found in the `menuInfo`)).

Use `https://developer.android.com/reference/androidx/fragment/app/Fragment#onContextItemSelected(android.view.MenuItem)` to know when an item has been selected.

The default implementation calls up to `https://developer.android.com/reference/android/app/Activity.html#onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo)`, though you can not call this implementation if you don't want that behavior.

It is not safe to hold onto the context menu after this method returns.

### onCreateOptionsMenu

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.5.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.5.0)

```
@MainThread
public void [onCreateOptionsMenu](https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateOptionsMenu(android.view.Menu,android.view.MenuInflater))(@NonNull Menu menu, @NonNull MenuInflater inflater)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> `https://developer.android.com/reference/androidx/activity/ComponentActivity` now implements `https://developer.android.com/reference/androidx/core/view/MenuHost`, an interface that allows any component, including your activity itself, to add menu items by calling `https://developer.android.com/reference/androidx/activity/ComponentActivity#addMenuProvider(androidx.core.view.MenuProvider)` without forcing all components through this single method override. As this provides a consistent, optionally `https://developer.android.com/reference/androidx/lifecycle/Lifecycle`-aware, and modular way to handle menu creation and item selection, replace usages of this method with one or more calls to `https://developer.android.com/reference/androidx/activity/ComponentActivity#addMenuProvider(androidx.core.view.MenuProvider)` in your Activity's `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreate(android.os.Bundle)` method, having each provider override `https://developer.android.com/reference/androidx/core/view/MenuProvider#onCreateMenu(android.view.Menu,android.view.MenuInflater)` to create their menu items.

Initialize the contents of the Fragment host's standard options menu. You should place your menu items in to <var translate="no">menu</var>. For this method to be called, you must have first called `https://developer.android.com/reference/androidx/fragment/app/Fragment#setHasOptionsMenu(boolean)`. See `https://developer.android.com/reference/android/app/Activity.html#onCreateOptionsMenu(android.view.Menu)` for more information.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/Menu.html menu` | The options menu in which you place your items. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#setHasOptionsMenu(boolean)` |   |
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#onPrepareOptionsMenu(android.view.Menu)` |   |
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#onOptionsItemSelected(android.view.MenuItem)` |   |

### onCreateView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
public @Nullable View onCreateView(
    @NonNull LayoutInflater inflater,
    @Nullable ViewGroup container,
    @Nullable Bundle savedInstanceState
)
```

Called to have the fragment instantiate its user interface view. This is optional, and non-graphical fragments can return null. This will be called between `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreate(android.os.Bundle)` and `https://developer.android.com/reference/androidx/fragment/app/Fragment#onViewCreated(android.view.View,android.os.Bundle)`.

A default View can be returned by calling `https://developer.android.com/reference/androidx/fragment/app/Fragment#Fragment(int)` in your constructor. Otherwise, this method returns null.

It is recommended to **only** inflate the layout in this method and move logic that operates on the returned View to `https://developer.android.com/reference/androidx/fragment/app/Fragment#onViewCreated(android.view.View,android.os.Bundle)`.

If you return a View from here, you will later be called in `https://developer.android.com/reference/androidx/fragment/app/Fragment#onDestroyView()` when the view is being released.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/LayoutInflater.html inflater` | The LayoutInflater object that can be used to inflate any views in the fragment, |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/view/ViewGroup.html container` | If non-null, this is the parent view that the fragment's UI should be attached to. The fragment should not add the view itself, but this can be used to generate the LayoutParams of the view. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html savedInstanceState` | If non-null, this fragment is being re-constructed from a previous saved state as given here. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/view/View.html` | Return the View for the fragment's UI, or null. |

### onDestroy

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
@CallSuper
public void onDestroy()
```

Called when the fragment is no longer in use. This is called after `https://developer.android.com/reference/androidx/fragment/app/Fragment#onStop()` and before `https://developer.android.com/reference/androidx/fragment/app/Fragment#onDetach()`.

### onDestroyOptionsMenu

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.5.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.5.0)

```
@MainThread
public void [onDestroyOptionsMenu](https://developer.android.com/reference/androidx/fragment/app/Fragment#onDestroyOptionsMenu())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> `https://developer.android.com/reference/androidx/activity/ComponentActivity` now implements `https://developer.android.com/reference/androidx/core/view/MenuHost`, an interface that allows any component, including your activity itself, to add menu items by calling `https://developer.android.com/reference/androidx/core/view/MenuHost#addMenuProvider(androidx.core.view.MenuProvider)` without forcing all components through this single method override. Each `https://developer.android.com/reference/androidx/core/view/MenuProvider` then provides a consistent, optionally `https://developer.android.com/reference/androidx/lifecycle/Lifecycle`-aware, and modular way to handle menu item selection for the menu items created by that provider. Replace usages of this method with one or more calls to `https://developer.android.com/reference/androidx/core/view/MenuHost#removeMenuProvider(androidx.core.view.MenuProvider)` in your Activity's `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreate(android.os.Bundle)` method, whenever it is necessary to remove the individual `https://developer.android.com/reference/androidx/core/view/MenuProvider`. If a `https://developer.android.com/reference/androidx/core/view/MenuProvider` was added with Lifecycle-awareness, this removal will happen automatically.

Called when this fragment's option menu items are no longer being included in the overall options menu. Receiving this call means that the menu needed to be rebuilt, but this fragment's items were not included in the newly built menu (its `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateOptionsMenu(android.view.Menu,android.view.MenuInflater)` was not called).

### onDestroyView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
@CallSuper
public void onDestroyView()
```

Called when the view previously created by `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)` has been detached from the fragment. The next time the fragment needs to be displayed, a new view will be created. This is called after `https://developer.android.com/reference/androidx/fragment/app/Fragment#onStop()` and before `https://developer.android.com/reference/androidx/fragment/app/Fragment#onDestroy()`. It is called *regardless* of whether `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)` returned a non-null view. Internally it is called after the view's state has been saved but before it has been removed from its parent.

### onDetach

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
@CallSuper
public void onDetach()
```

Called when the fragment is no longer attached to its activity. This is called after `https://developer.android.com/reference/androidx/fragment/app/Fragment#onDestroy()`.

### onGetLayoutInflater

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public @NonNull LayoutInflater onGetLayoutInflater(@Nullable Bundle savedInstanceState)
```

Returns the LayoutInflater used to inflate Views of this Fragment. The default implementation will throw an exception if the Fragment is not attached.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html savedInstanceState` | If the fragment is being re-created from a previous saved state, this is the state. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/LayoutInflater.html` | The LayoutInflater used to inflate Views of this Fragment. |

### onHiddenChanged

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
public void onHiddenChanged(boolean hidden)
```

Called when the hidden state (as returned by `https://developer.android.com/reference/androidx/fragment/app/Fragment#isHidden()` of the fragment or another fragment in its hierarchy has changed. Fragments start out not hidden; this will be called whenever the fragment changes state from that.

| Parameters |
|---|---|
| `boolean hidden` | True if the fragment is now hidden, false otherwise. |

### onInflate

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@UiThread
@CallSuper
public void [onInflate](https://developer.android.com/reference/androidx/fragment/app/Fragment#onInflate(android.app.Activity,android.util.AttributeSet,android.os.Bundle))(
    @NonNull Activity activity,
    @NonNull AttributeSet attrs,
    @Nullable Bundle savedInstanceState
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> See `https://developer.android.com/reference/androidx/fragment/app/Fragment#onInflate(android.content.Context,android.util.AttributeSet,android.os.Bundle)`.

Called when a fragment is being created as part of a view layout inflation, typically from setting the content view of an activity.

### onInflate

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@UiThread
@CallSuper
public void onInflate(
    @NonNull Context context,
    @NonNull AttributeSet attrs,
    @Nullable Bundle savedInstanceState
)
```

Called when a fragment is being created as part of a view layout inflation, typically from setting the content view of an activity. This may be called immediately after the fragment is created from a `https://developer.android.com/reference/androidx/fragment/app/FragmentContainerView` in a layout file. Note this is *before* the fragment's `https://developer.android.com/reference/androidx/fragment/app/Fragment#onAttach(android.content.Context)` has been called; all you should do here is parse the attributes and save them away.

This is called *the first time* the fragment is inflated. If it is being inflated into a new instance with saved state, this method will not be called a second time for the restored state fragment.

Here is a typical implementation of a fragment that can take parameters both through attributes supplied here as well from `https://developer.android.com/reference/androidx/fragment/app/Fragment#getArguments()`:

```java
public static class MyFragment extends Fragment {
    CharSequence mLabel;

    /**
     * Create a new instance of MyFragment that will be initialized
     * with the given arguments.
     */
    static MyFragment newInstance(CharSequence label) {
        MyFragment f = new MyFragment();
        Bundle b = new Bundle();
        b.putCharSequence("label", label);
        f.setArguments(b);
        return f;
    }

    /**
     * Parse attributes during inflation from a view hierarchy into the
     * arguments we handle.
     */
    @Override
    public void onInflate(@NonNull Context context, @NonNull AttributeSet attrs,
            @Nullable Bundle savedInstanceState) {
        super.onInflate(context, attrs, savedInstanceState);

        TypedArray a = context.obtainStyledAttributes(attrs,
                R.styleable.FragmentArguments);
        mLabel = a.getText(R.styleable.FragmentArguments_android_label);
        a.recycle();
    }

    /**
     * During creation, if arguments have been supplied to the fragment
     * then parse those out.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Bundle args = getArguments();
        if (args != null) {
            CharSequence label = args.getCharSequence("label");
            if (label != null) {
                mLabel = label;
            }
        }
    }

    /**
     * Create the view for this fragment, using the arguments given to it.
     */
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.hello_world, container, false);
        View tv = v.findViewById(R.id.text);
        ((TextView)tv).setText(mLabel != null ? mLabel : "(no label)");
        ViewCompat.setBackground(
                tv, ContextCompat.getDrawable(getContext(), android.R.drawable.gallery_thumb));
        return v;
    }
}
```

Note that parsing the XML attributes uses a "styleable" resource. The declaration for the styleable used here is:

```xml
<declare-styleable name="FragmentArguments">
    <attr name="android:label" />
</declare-styleable>
```

The fragment can then be declared within its activity's content layout through a tag like this:

```xml
<androidx.fragment.app.FragmentContainerView
        class="com.example.android.supportv4.app.FragmentArgumentsSupport$MyFragment"
        android:id="@+id/embedded"
        android:layout_width="0px" android:layout_height="wrap_content"
        android:layout_weight="1"
        android:label="@string/fragment_arguments_embedded" />
```

This fragment can also be created dynamically from arguments given at runtime in the arguments Bundle; here is an example of doing so at creation of the containing activity:

```java
@Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_arguments_support);

    if (savedInstanceState == null) {
        // First-time init; create fragment to embed in activity.
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        Fragment newFragment = MyFragment.newInstance("From Arguments");
        ft.add(R.id.created, newFragment);
        ft.commit();
    }
}
```

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | The Activity that is inflating this fragment. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/util/AttributeSet.html attrs` | The attributes at the tag where the fragment is being created. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html savedInstanceState` | If the fragment is being re-created from a previous saved state, this is the state. |

### onLowMemory

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
@CallSuper
public void onLowMemory()
```

> [!CAUTION]
> **This method is deprecated.**   

### onMultiWindowModeChanged

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void onMultiWindowModeChanged(boolean isInMultiWindowMode)
```

Called when the Fragment's activity changes from fullscreen mode to multi-window mode and visa-versa. This is generally tied to `https://developer.android.com/reference/android/app/Activity.html#onMultiWindowModeChanged(boolean)` of the containing Activity.

| Parameters |
|---|---|
| `boolean isInMultiWindowMode` | True if the activity is in multi-window mode. |

### onOptionsItemSelected

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.5.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.5.0)

```
@MainThread
public boolean [onOptionsItemSelected](https://developer.android.com/reference/androidx/fragment/app/Fragment#onOptionsItemSelected(android.view.MenuItem))(@NonNull MenuItem item)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> `https://developer.android.com/reference/androidx/activity/ComponentActivity` now implements `https://developer.android.com/reference/androidx/core/view/MenuHost`, an interface that allows any component, including your activity itself, to add menu items by calling `https://developer.android.com/reference/androidx/core/view/MenuHost#addMenuProvider(androidx.core.view.MenuProvider)` without forcing all components through this single method override. Each `https://developer.android.com/reference/androidx/core/view/MenuProvider` then provides a consistent, optionally `https://developer.android.com/reference/androidx/lifecycle/Lifecycle`-aware, and modular way to handle menu item selection for the menu items created by that provider. Replace usages of this method with one or more calls to `https://developer.android.com/reference/androidx/core/view/MenuHost#addMenuProvider(androidx.core.view.MenuProvider)` in your Activity's `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreate(android.os.Bundle)` method, delegating menu item selection to the individual `https://developer.android.com/reference/androidx/core/view/MenuProvider` that created the menu items you wish to handle.

This hook is called whenever an item in your options menu is selected. The default implementation simply returns false to have the normal processing happen (calling the item's Runnable or sending a message to its Handler as appropriate). You can use this method for any items for which you would like to do processing without those other facilities.

Derived classes should call through to the base class for it to perform the default menu handling.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/MenuItem.html item` | The menu item that was selected. |

| Returns |
|---|---|
| `boolean` | boolean Return false to allow normal menu processing to proceed, true to consume it here. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateOptionsMenu(android.view.Menu,android.view.MenuInflater)` |   |

### onOptionsMenuClosed

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.5.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.5.0)

```
@MainThread
public void [onOptionsMenuClosed](https://developer.android.com/reference/androidx/fragment/app/Fragment#onOptionsMenuClosed(android.view.Menu))(@NonNull Menu menu)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> `https://developer.android.com/reference/androidx/activity/ComponentActivity` now implements `https://developer.android.com/reference/androidx/core/view/MenuHost`, an interface that allows any component, including your activity itself, to add menu items by calling `https://developer.android.com/reference/androidx/core/view/MenuHost#addMenuProvider(androidx.core.view.MenuProvider)` without forcing all components through this single method override. The `https://developer.android.com/reference/androidx/core/view/MenuProvider` interface uses a single `https://developer.android.com/reference/androidx/core/view/MenuProvider#onCreateMenu(android.view.Menu,android.view.MenuInflater)` method for managing both the creation and preparation of menu items. Replace usages of this method with one or more calls to `https://developer.android.com/reference/androidx/core/view/MenuHost#addMenuProvider(androidx.core.view.MenuProvider)` in your Activity's `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreate(android.os.Bundle)` method, overriding `https://developer.android.com/reference/androidx/core/view/MenuProvider#onMenuClosed(android.view.Menu)` to delegate menu closing to the individual `https://developer.android.com/reference/androidx/core/view/MenuProvider` that created the menu.

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).

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/Menu.html menu` | The options menu as last shown or first initialized by onCreateOptionsMenu(). |

### onPause

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
@CallSuper
public void onPause()
```

Called when the Fragment is no longer resumed. This is generally tied to `https://developer.android.com/reference/android/app/Activity.html#onPause()` of the containing Activity's lifecycle.

### onPictureInPictureModeChanged

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode)
```

Called by the system when the activity changes to and from picture-in-picture mode. This is generally tied to `https://developer.android.com/reference/android/app/Activity.html#onPictureInPictureModeChanged(boolean)` of the containing Activity.

| Parameters |
|---|---|
| `boolean isInPictureInPictureMode` | True if the activity is in picture-in-picture mode. |

### onPrepareOptionsMenu

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.5.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.5.0)

```
@MainThread
public void [onPrepareOptionsMenu](https://developer.android.com/reference/androidx/fragment/app/Fragment#onPrepareOptionsMenu(android.view.Menu))(@NonNull Menu menu)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> `https://developer.android.com/reference/androidx/activity/ComponentActivity` now implements `https://developer.android.com/reference/androidx/core/view/MenuHost`, an interface that allows any component, including your activity itself, to add menu items by calling `https://developer.android.com/reference/androidx/core/view/MenuHost#addMenuProvider(androidx.core.view.MenuProvider)` without forcing all components through this single method override. The `https://developer.android.com/reference/androidx/core/view/MenuProvider` interface uses a single `https://developer.android.com/reference/androidx/core/view/MenuProvider#onCreateMenu(android.view.Menu,android.view.MenuInflater)` method for managing both the creation and preparation of menu items. Replace usages of this method with one or more calls to `https://developer.android.com/reference/androidx/core/view/MenuHost#addMenuProvider(androidx.core.view.MenuProvider)` in your Activity's `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreate(android.os.Bundle)` method, moving any preparation of menu items to `https://developer.android.com/reference/androidx/core/view/MenuProvider#onPrepareMenu(android.view.Menu)`.

Prepare the Fragment host's standard options menu to be displayed. This is called right before the menu is shown, every time it is shown. You can use this method to efficiently enable/disable items or otherwise dynamically modify the contents. See `https://developer.android.com/reference/android/app/Activity.html#onPrepareOptionsMenu(android.view.Menu)` for more information.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/Menu.html menu` | The options menu as last shown or first initialized by onCreateOptionsMenu(). |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#setHasOptionsMenu(boolean)` |   |
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateOptionsMenu(android.view.Menu,android.view.MenuInflater)` |   |

### onPrimaryNavigationFragmentChanged

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
public void onPrimaryNavigationFragmentChanged(
    boolean isPrimaryNavigationFragment
)
```

Callback for when the primary navigation state of this Fragment has changed. This can be the result of the `https://developer.android.com/reference/androidx/fragment/app/Fragment#getParentFragmentManager()` containing FragmentManager} having its primary navigation fragment changed via `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#setPrimaryNavigationFragment(androidx.fragment.app.Fragment)` or due to the primary navigation fragment changing in a parent FragmentManager.

| Parameters |
|---|---|
| `boolean isPrimaryNavigationFragment` | True if and only if this Fragment and any `https://developer.android.com/reference/androidx/fragment/app/Fragment#getParentFragment()` is set as the primary navigation fragment via `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#setPrimaryNavigationFragment(androidx.fragment.app.Fragment)`. |

### onRequestPermissionsResult

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.3.0)

```
public void [onRequestPermissionsResult](https://developer.android.com/reference/androidx/fragment/app/Fragment#onRequestPermissionsResult(int,java.lang.String[],int[]))(
    int requestCode,
    @NonNull String[] permissions,
    @NonNull int[] grantResults
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment. Use `https://developer.android.com/reference/androidx/fragment/app/Fragment#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract<I,O>,androidx.activity.result.ActivityResultCallback<O>)` passing in a `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts.RequestMultiplePermissions` object for the `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` and handling the result in the `https://developer.android.com/reference/androidx/activity/result/ActivityResultCallback#onActivityResult(O)`.

Callback for the result from requesting permissions. This method is invoked for every call on `https://developer.android.com/reference/androidx/fragment/app/Fragment#requestPermissions(java.lang.String[],int)`.

**Note:** It is possible that the permissions request interaction with the user is interrupted. In this case you will receive empty permissions and results arrays which should be treated as a cancellation.

| Parameters |
|---|---|
| `int requestCode` | The request code passed in `https://developer.android.com/reference/androidx/fragment/app/Fragment#requestPermissions(java.lang.String[],int)`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html String[] permissions` | The requested permissions. Never null. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html int[] grantResults` | The grant results for the corresponding permissions which is either `https://developer.android.com/reference/android/content/pm/PackageManager.html#PERMISSION_GRANTED` or `https://developer.android.com/reference/android/content/pm/PackageManager.html#PERMISSION_DENIED`. Never null. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#requestPermissions(java.lang.String[],int)` |   |

### onResume

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
@CallSuper
public void onResume()
```

Called when the fragment is visible to the user and actively running. This is generally tied to `https://developer.android.com/reference/android/app/Activity.html#onResume()` of the containing Activity's lifecycle.

### onSaveInstanceState

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
public void onSaveInstanceState(@NonNull Bundle outState)
```

Called to ask the fragment to save its current dynamic state, so it can later be reconstructed in a new instance if its process is restarted. If a new instance of the fragment later needs to be created, the data you place in the Bundle here will be available in the Bundle given to `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreate(android.os.Bundle)`, `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`, and `https://developer.android.com/reference/androidx/fragment/app/Fragment#onViewCreated(android.view.View,android.os.Bundle)`.

This corresponds to `https://developer.android.com/reference/android/app/Activity.html#onSaveInstanceState(android.os.Bundle)` and most of the discussion there applies here as well. Note however: *this method may be called at any time before `https://developer.android.com/reference/androidx/fragment/app/Fragment#onDestroy()`*. There are many situations where a fragment may be mostly torn down (such as when placed on the back stack with no UI showing), but its state will not be saved until its owning activity actually needs to save its state.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html outState` | Bundle in which to place your saved state. |

### onStart

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
@CallSuper
public void onStart()
```

Called when the Fragment is visible to the user. This is generally tied to `https://developer.android.com/reference/android/app/Activity.html#onStart()` of the containing Activity's lifecycle.

### onStop

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
@CallSuper
public void onStop()
```

Called when the Fragment is no longer started. This is generally tied to `https://developer.android.com/reference/android/app/Activity.html#onStop()` of the containing Activity's lifecycle.

### onViewCreated

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState)
```

Called immediately after `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)` has returned, but before any saved state has been restored in to the view. This gives subclasses a chance to initialize themselves once they know their view hierarchy has been completely created. The fragment's view hierarchy is not however attached to its parent at this point.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html view` | The View returned by `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html savedInstanceState` | If non-null, this fragment is being re-constructed from a previous saved state as given here. |

### onViewStateRestored

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
@MainThread
@CallSuper
public void onViewStateRestored(@Nullable Bundle savedInstanceState)
```

Called when all saved state has been restored into the view hierarchy of the fragment. This can be used to do initialization based on saved state that you are letting the view hierarchy track itself, such as whether check box widgets are currently checked. This is called after `https://developer.android.com/reference/androidx/fragment/app/Fragment#onViewCreated(android.view.View,android.os.Bundle)` and before `https://developer.android.com/reference/androidx/fragment/app/Fragment#onStart()`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html savedInstanceState` | If the fragment is being re-created from a previous saved state, this is the state. |

### peekAvailableContext

Added in [1.9.1](https://developer.android.com/jetpack/androidx/releases/fragment#1.9.1)

```
public @Nullable Context peekAvailableContext()
```

Get the `https://developer.android.com/reference/android/content/Context.html` if it is currently available. If this returns `null`, you can use `https://developer.android.com/reference/androidx/activity/contextaware/ContextAware#addOnContextAvailableListener(androidx.activity.contextaware.OnContextAvailableListener)` to receive a callback for when it available.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/Context.html` | the Context if it is currently available. |

### postponeEnterTransition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void postponeEnterTransition()
```

Postpone the entering Fragment transition until `https://developer.android.com/reference/androidx/fragment/app/Fragment#startPostponedEnterTransition()` or `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#executePendingTransactions()` has been called.

This method gives the Fragment the ability to delay Fragment animations until all data is loaded. Until then, the added, shown, and attached Fragments will be INVISIBLE and removed, hidden, and detached Fragments won't be have their Views removed. The transaction runs when all postponed added Fragments in the transaction have called `https://developer.android.com/reference/androidx/fragment/app/Fragment#startPostponedEnterTransition()`.

This method should be called before being added to the FragmentTransaction or in `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreate(android.os.Bundle)`, `https://developer.android.com/reference/androidx/fragment/app/Fragment#onAttach(android.content.Context)`, or `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`}. `https://developer.android.com/reference/androidx/fragment/app/Fragment#startPostponedEnterTransition()` must be called to allow the Fragment to start the transitions.

When a FragmentTransaction is started that may affect a postponed FragmentTransaction, based on which containers are in their operations, the postponed FragmentTransaction will have its start triggered. The early triggering may result in faulty or nonexistent animations in the postponed transaction. FragmentTransactions that operate only on independent containers will not interfere with each other's postponement.

Calling postponeEnterTransition on Fragments with a null View will not postpone the transition.

| See also |
|---|---|
| `https://developer.android.com/reference/android/app/Activity.html#postponeEnterTransition()` |   |
| `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#setReorderingAllowed(boolean)` |   |

### postponeEnterTransition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final void postponeEnterTransition(long duration, @NonNull TimeUnit timeUnit)
```

Postpone the entering Fragment transition for a given amount of time and then call `https://developer.android.com/reference/androidx/fragment/app/Fragment#startPostponedEnterTransition()`.

This method gives the Fragment the ability to delay Fragment animations for a given amount of time. Until then, the added, shown, and attached Fragments will be INVISIBLE and removed, hidden, and detached Fragments won't be have their Views removed. The transaction runs when all postponed added Fragments in the transaction have called `https://developer.android.com/reference/androidx/fragment/app/Fragment#startPostponedEnterTransition()`.

This method should be called before being added to the FragmentTransaction or in `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreate(android.os.Bundle)`, `https://developer.android.com/reference/androidx/fragment/app/Fragment#onAttach(android.content.Context)`, or `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`}.

When a FragmentTransaction is started that may affect a postponed FragmentTransaction, based on which containers are in their operations, the postponed FragmentTransaction will have its start triggered. The early triggering may result in faulty or nonexistent animations in the postponed transaction. FragmentTransactions that operate only on independent containers will not interfere with each other's postponement.

Calling postponeEnterTransition on Fragments with a null View will not postpone the transition.

| Parameters |
|---|---|
| `long duration` | The length of the delay in `timeUnit` units |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/TimeUnit.html timeUnit` | The units of time for `duration` |

| See also |
|---|---|
| `https://developer.android.com/reference/android/app/Activity.html#postponeEnterTransition()` |   |
| `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#setReorderingAllowed(boolean)` |   |

### registerForActivityResult

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.3.0)

```
@MainThread
public final @NonNull ActivityResultLauncher<I> <I, O> registerForActivityResult(
    @NonNull ActivityResultContract<I, O> contract,
    @NonNull ActivityResultCallback<O> callback
)
```


Register a request to `https://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)`, designated by the given `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract`.

This creates a record in the `https://developer.android.com/reference/androidx/activity/result/ActivityResultRegistry` associated with this caller, managing request code, as well as conversions to/from `https://developer.android.com/reference/android/content/Intent.html` under the hood.

This *must* be called unconditionally, as part of initialization path, typically as a field initializer of an Activity or Fragment.

<br />

If the host of this fragment is an `https://developer.android.com/reference/androidx/activity/result/ActivityResultRegistryOwner` the `https://developer.android.com/reference/androidx/activity/result/ActivityResultRegistry` of the host will be used. Otherwise, this will use the registry of the Fragment's Activity.

### registerForActivityResult

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.3.0)

```
@MainThread
public final @NonNull ActivityResultLauncher<I> <I, O> registerForActivityResult(
    @NonNull ActivityResultContract<I, O> contract,
    @NonNull ActivityResultRegistry registry,
    @NonNull ActivityResultCallback<O> callback
)
```

Register a request to `https://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)`, designated by the given `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract`.

This creates a record in the given `https://developer.android.com/reference/androidx/activity/result/ActivityResultRegistry`, managing request code, as well as conversions to/from `https://developer.android.com/reference/android/content/Intent.html` under the hood.

This *must* be called unconditionally, as part of initialization path, typically as a field initializer of an Activity or Fragment.

| Parameters |
|---|---|
| `<I>` | the type of the input(if any) required to call the activity |
| `<O>` | the type of output returned as an activity result |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract<I, O> contract` | the contract, specifying conversions to/from `https://developer.android.com/reference/android/content/Intent.html`s |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/activity/result/ActivityResultRegistry registry` | the registry where to hold the record. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/activity/result/ActivityResultCallback<O> callback` | the callback to be called on the main thread when activity result is available |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/activity/result/ActivityResultLauncher<I>` | the launcher that can be used to start the activity or dispose of the prepared call. |

### registerForContextMenu

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void registerForContextMenu(@NonNull View view)
```

Registers a context menu to be shown for the given view (multiple views can show the context menu). This method will set the `https://developer.android.com/reference/android/view/View.OnCreateContextMenuListener.html` on the view to this fragment, so `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateContextMenu(android.view.ContextMenu,android.view.View,android.view.ContextMenu.ContextMenuInfo)` will be called when it is time to show the context menu.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html view` | The view that should show a context menu. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#unregisterForContextMenu(android.view.View)` |   |

### removeOnContextAvailableListener

Added in [1.9.1](https://developer.android.com/jetpack/androidx/releases/fragment#1.9.1)

```
public void removeOnContextAvailableListener(
    @NonNull OnContextAvailableListener listener
)
```

Remove a `https://developer.android.com/reference/androidx/activity/contextaware/OnContextAvailableListener` previously added via `https://developer.android.com/reference/androidx/activity/contextaware/ContextAware#addOnContextAvailableListener(androidx.activity.contextaware.OnContextAvailableListener)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/activity/contextaware/OnContextAvailableListener listener` | The listener that should be removed. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/activity/contextaware/ContextAware#addOnContextAvailableListener(androidx.activity.contextaware.OnContextAvailableListener)` |   |

### requestPermissions

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.3.0)

```
public final void [requestPermissions](https://developer.android.com/reference/androidx/fragment/app/Fragment#requestPermissions(java.lang.String[],int))(@NonNull String[] permissions, int requestCode)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment. Use `https://developer.android.com/reference/androidx/fragment/app/Fragment#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract<I,O>,androidx.activity.result.ActivityResultCallback<O>)` passing in a `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts.RequestMultiplePermissions` object for the `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` and handling the result in the `https://developer.android.com/reference/androidx/activity/result/ActivityResultCallback#onActivityResult(O)`.

Requests permissions to be granted to this application. These permissions must be requested in your manifest, they should not be granted to your app, and they should have protection level `https://developer.android.com/reference/android/content/pm/PermissionInfo.html`, regardless whether they are declared by the platform or a third-party app.

Normal permissions `https://developer.android.com/reference/android/content/pm/PermissionInfo.html#PROTECTION_NORMAL` are granted at install time if requested in the manifest. Signature permissions `https://developer.android.com/reference/android/content/pm/PermissionInfo.html#PROTECTION_SIGNATURE` are granted at install time if requested in the manifest and the signature of your app matches the signature of the app declaring the permissions.

Call `https://developer.android.com/reference/androidx/fragment/app/Fragment#shouldShowRequestPermissionRationale(java.lang.String)` before calling this API to check if the system recommends to show a rationale dialog before asking for a permission.

If your app does not have the requested permissions the user will be presented with UI for accepting them. After the user has accepted or rejected the requested permissions you will receive a callback on `https://developer.android.com/reference/androidx/fragment/app/Fragment#onRequestPermissionsResult(int,java.lang.String[],int[])` reporting whether the permissions were granted or not.

Note that requesting a permission does not guarantee it will be granted and your app should be able to run without having this permission.

This method may start an activity allowing the user to choose which permissions to grant and which to reject. Hence, you should be prepared that your activity may be paused and resumed. Further, granting some permissions may require a restart of you application. In such a case, the system will recreate the activity stack before delivering the result to `https://developer.android.com/reference/androidx/fragment/app/Fragment#onRequestPermissionsResult(int,java.lang.String[],int[])`.

When checking whether you have a permission you should use `https://developer.android.com/reference/android/content/Context.html#checkSelfPermission(java.lang.String)`.

Calling this API for permissions already granted to your app would show UI to the user to decide whether the app can still hold these permissions. This can be useful if the way your app uses the data guarded by the permissions changes significantly.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html String[] permissions` | The requested permissions. |
| `int requestCode` | Application specific request code to match with a result reported to `https://developer.android.com/reference/androidx/fragment/app/Fragment#onRequestPermissionsResult(int,java.lang.String[],int[])`. Must be between 0 and 65535 to be considered valid. If given requestCode is greater than 65535, an IllegalArgumentException would be thrown. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#onRequestPermissionsResult(int,java.lang.String[],int[])` |   |
| `https://developer.android.com/reference/android/content/Context.html#checkSelfPermission(java.lang.String)` |   |

### requireActivity

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final @NonNull FragmentActivity requireActivity()
```

Return the `https://developer.android.com/reference/androidx/fragment/app/FragmentActivity` this fragment is currently associated with.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if not currently associated with an activity or if associated only with a context. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#getActivity()` |   |

### requireArguments

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final @NonNull Bundle requireArguments()
```

Return the arguments supplied when the fragment was instantiated.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if no arguments were supplied to the Fragment. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#getArguments()` |   |

### requireContext

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final @NonNull Context requireContext()
```

Return the `https://developer.android.com/reference/android/content/Context.html` this fragment is currently associated with.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if not currently associated with a context. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#getContext()` |   |

### requireFragmentManager

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.2.0)

```
public final @NonNull FragmentManager [requireFragmentManager](https://developer.android.com/reference/androidx/fragment/app/Fragment#requireFragmentManager())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> This has been renamed to `getParentFragmentManager()` to make it clear that you are accessing the FragmentManager that contains this Fragment and not the FragmentManager associated with child Fragments.

Return the FragmentManager for interacting with fragments associated with this fragment's activity. Note that this will be available slightly before `https://developer.android.com/reference/androidx/fragment/app/Fragment#getActivity()`, during the time from when the fragment is placed in a `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction` until it is committed and attached to its activity.

If this Fragment is a child of another Fragment, the FragmentManager returned here will be the parent's `https://developer.android.com/reference/androidx/fragment/app/Fragment#getChildFragmentManager()`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if not associated with a transaction or host. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#getParentFragmentManager()` |   |

### requireHost

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final @NonNull Object requireHost()
```

Return the host object of this fragment.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if not currently associated with a host. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#getHost()` |   |

### requireParentFragment

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final @NonNull Fragment requireParentFragment()
```

Returns the parent Fragment containing this Fragment.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if this Fragment is attached directly to an Activity or other Fragment host. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#getParentFragment()` |   |

### requireView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public final @NonNull View requireView()
```

Get the root view for the fragment's layout (the one returned by `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`).

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if no view was returned by `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#getView()` |   |

### setAllowEnterTransitionOverlap

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void setAllowEnterTransitionOverlap(boolean allow)
```

Sets whether the the exit transition and enter transition overlap or not. When true, the enter transition will start as soon as possible. When false, the enter transition will wait until the exit transition completes before starting.

| Parameters |
|---|---|
| `boolean allow` | true to start the enter transition when possible or false to wait until the exiting transition completes. |

### setAllowReturnTransitionOverlap

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void setAllowReturnTransitionOverlap(boolean allow)
```

Sets whether the the return transition and reenter transition overlap or not. When true, the reenter transition will start as soon as possible. When false, the reenter transition will wait until the return transition completes before starting.

| Parameters |
|---|---|
| `boolean allow` | true to start the reenter transition when possible or false to wait until the return transition completes. |

### setArguments

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void setArguments(@Nullable Bundle args)
```

Supply the construction arguments for this fragment. The arguments supplied here will be retained across fragment destroy and creation.

This method cannot be called if the fragment is added to a FragmentManager and if `https://developer.android.com/reference/androidx/fragment/app/Fragment#isStateSaved()` would return true.

### setEnterSharedElementCallback

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void setEnterSharedElementCallback(@Nullable SharedElementCallback callback)
```

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.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/app/SharedElementCallback callback` | Used to manipulate the shared element transitions on this Fragment when added not as a pop from the back stack. |

### setEnterTransition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void setEnterTransition(@Nullable Object transition)
```

Sets the Transition that will be used to move Views into the initial scene. The entering Views will be those that are regular Views or ViewGroups that have `https://developer.android.com/reference/android/view/ViewGroup.html#isTransitionGroup()` return true. Typical Transitions will extend `https://developer.android.com/reference/android/transition/Visibility.html` as entering is governed by changing visibility from `https://developer.android.com/reference/android/view/View.html#INVISIBLE` to `https://developer.android.com/reference/android/view/View.html#VISIBLE`. If `transition` is null, entering Views will remain unaffected.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html transition` | The Transition to use to move Views into the initial Scene. `transition` must be an `https://developer.android.com/reference/android/transition/Transition.html` or `https://developer.android.com/reference/androidx/transition/Transition`. |

### setExitSharedElementCallback

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void setExitSharedElementCallback(@Nullable SharedElementCallback callback)
```

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.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/app/SharedElementCallback callback` | Used to manipulate the shared element transitions on this Fragment when added as a pop from the back stack. |

### setExitTransition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void setExitTransition(@Nullable Object transition)
```

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. The exiting Views will be those that are regular Views or ViewGroups that have `https://developer.android.com/reference/android/view/ViewGroup.html#isTransitionGroup()` return true. Typical Transitions will extend `https://developer.android.com/reference/android/transition/Visibility.html` as exiting is governed by changing visibility from `https://developer.android.com/reference/android/view/View.html#VISIBLE` to `https://developer.android.com/reference/android/view/View.html#INVISIBLE`. If transition is null, the views will remain unaffected.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html transition` | The Transition to use to move Views out of the Scene when the Fragment is being closed not due to popping the back stack. `transition`must be an `https://developer.android.com/reference/android/transition/Transition.html` or `https://developer.android.com/reference/androidx/transition/Transition`. |

### setHasOptionsMenu

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.5.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.5.0)

```
public void [setHasOptionsMenu](https://developer.android.com/reference/androidx/fragment/app/Fragment#setHasOptionsMenu(boolean))(boolean hasMenu)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> This method is no longer needed when using a `https://developer.android.com/reference/androidx/core/view/MenuProvider` to provide a `https://developer.android.com/reference/android/view/Menu.html` to your activity, which replaces `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateOptionsMenu(android.view.Menu,android.view.MenuInflater)` as the recommended way to provide a consistent, optionally `https://developer.android.com/reference/androidx/lifecycle/Lifecycle`-aware, and modular way to handle menu creation and item selection.

Report that this fragment would like to participate in populating the options menu by receiving a call to `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreateOptionsMenu(android.view.Menu,android.view.MenuInflater)` and related methods.

| Parameters |
|---|---|
| `boolean hasMenu` | If true, the fragment has menu items to contribute. |

### setInitialSavedState

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void setInitialSavedState(@Nullable Fragment.SavedState state)
```

Set the initial saved state that this Fragment should restore itself from when first being constructed, as returned by `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#saveFragmentInstanceState(androidx.fragment.app.Fragment)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/fragment/app/Fragment.SavedState state` | The state the fragment should be restored from. |

### setMenuVisibility

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void setMenuVisibility(boolean menuVisible)
```

Set a hint for whether this fragment's menu should be visible. This is useful if you know that a fragment has been placed in your view hierarchy so that the user can not currently seen it, so any menu items it has should also not be shown.

| Parameters |
|---|---|
| `boolean menuVisible` | The default is true, meaning the fragment's menu will be shown as usual. If false, the user will not see the menu. |

### setReenterTransition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void setReenterTransition(@Nullable Object transition)
```

Sets the Transition that will be used to move Views in to the scene when returning due to popping a back stack. The entering Views will be those that are regular Views or ViewGroups that have `https://developer.android.com/reference/android/view/ViewGroup.html#isTransitionGroup()` return true. Typical Transitions will extend `https://developer.android.com/reference/android/transition/Visibility.html` as exiting is governed by changing visibility from `https://developer.android.com/reference/android/view/View.html#VISIBLE` to `https://developer.android.com/reference/android/view/View.html#INVISIBLE`. If transition is null, the views will remain unaffected. If nothing is set, the default will be to use the same transition as `https://developer.android.com/reference/androidx/fragment/app/Fragment#getExitTransition()`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html transition` | The Transition to use to move Views into the scene when reentering from a previously-started Activity due to popping the back stack. `transition`must be an `https://developer.android.com/reference/android/transition/Transition.html` or `https://developer.android.com/reference/androidx/transition/Transition`. |

### setRetainInstance

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.3.0)

```
public void [setRetainInstance](https://developer.android.com/reference/androidx/fragment/app/Fragment#setRetainInstance(boolean))(boolean retain)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Instead of retaining the Fragment itself, use a non-retained Fragment and keep retained state in a ViewModel attached to that Fragment. The ViewModel's constructor and its onCleared() callback provide the signal for initial creation and final destruction of the retained state.

Control whether a fragment instance is retained across Activity re-creation (such as from a configuration change). If set, the fragment lifecycle will be slightly different when an activity is recreated:

- `https://developer.android.com/reference/androidx/fragment/app/Fragment#onDestroy()` will not be called (but `https://developer.android.com/reference/androidx/fragment/app/Fragment#onDetach()` still will be, because the fragment is being detached from its current activity).
- `https://developer.android.com/reference/androidx/fragment/app/Fragment#onCreate(android.os.Bundle)` will not be called since the fragment is not being re-created.
- `https://developer.android.com/reference/androidx/fragment/app/Fragment#onAttach(android.app.Activity)` and `https://developer.android.com/reference/androidx/fragment/app/Fragment#onActivityCreated(android.os.Bundle)`**will** still be called.

| Parameters |
|---|---|
| `boolean retain` | `true` to retain this fragment instance across configuration changes, `false` otherwise. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#getRetainInstance()` |   |

### setReturnTransition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void setReturnTransition(@Nullable Object transition)
```

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. The exiting Views will be those that are regular Views or ViewGroups that have `https://developer.android.com/reference/android/view/ViewGroup.html#isTransitionGroup()` return true. Typical Transitions will extend `https://developer.android.com/reference/android/transition/Visibility.html` as entering is governed by changing visibility from `https://developer.android.com/reference/android/view/View.html#VISIBLE` to `https://developer.android.com/reference/android/view/View.html#INVISIBLE`. If `transition` is null, entering Views will remain unaffected. If nothing is set, the default will be to use the same value as set in `https://developer.android.com/reference/androidx/fragment/app/Fragment#setEnterTransition(java.lang.Object)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html transition` | The Transition to use to move Views out of the Scene when the Fragment is preparing to close due to popping the back stack. `transition` must be an `https://developer.android.com/reference/android/transition/Transition.html` or `https://developer.android.com/reference/androidx/transition/Transition`. |

### setSharedElementEnterTransition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void setSharedElementEnterTransition(@Nullable Object transition)
```

Sets the Transition that will be used for shared elements transferred into the content Scene. Typical Transitions will affect size and location, such as `https://developer.android.com/reference/android/transition/ChangeBounds.html`. A null value will cause transferred shared elements to blink to the final position.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html transition` | The Transition to use for shared elements transferred into the content Scene. `transition` must be an `https://developer.android.com/reference/android/transition/Transition.html` or `https://developer.android.com/reference/androidx/transition/Transition`. |

### setSharedElementReturnTransition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void setSharedElementReturnTransition(@Nullable Object transition)
```

Sets the Transition that will be used for shared elements transferred back during a pop of the back stack. This Transition acts in the leaving Fragment. Typical Transitions will affect size and location, such as `https://developer.android.com/reference/android/transition/ChangeBounds.html`. A null value will cause transferred shared elements to blink to the final position. If no value is set, the default will be to use the same value as `https://developer.android.com/reference/androidx/fragment/app/Fragment#setSharedElementEnterTransition(java.lang.Object)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html transition` | The Transition to use for shared elements transferred out of the content Scene. `transition` must be an `https://developer.android.com/reference/android/transition/Transition.html` or `https://developer.android.com/reference/androidx/transition/Transition`. |

### setTargetFragment

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.3.0)

```
public void [setTargetFragment](https://developer.android.com/reference/androidx/fragment/app/Fragment#setTargetFragment(androidx.fragment.app.Fragment,int))(@Nullable Fragment fragment, int requestCode)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Instead of using a target fragment to pass results, the fragment requesting a result should use `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#setFragmentResultListener(java.lang.String,androidx.lifecycle.LifecycleOwner,androidx.fragment.app.FragmentResultListener)` to register a `https://developer.android.com/reference/androidx/fragment/app/FragmentResultListener` with a `
> requestKey` using its `https://developer.android.com/reference/androidx/fragment/app/Fragment#getParentFragmentManager()`. The fragment delivering a result should then call `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#setFragmentResult(java.lang.String,android.os.Bundle)` using the same `requestKey`. Consider using `https://developer.android.com/reference/androidx/fragment/app/Fragment#setArguments(android.os.Bundle)` to pass the `requestKey` if you need to support dynamic request keys.

Optional target for this fragment. This may be used, for example, if this fragment is being started by another, and when done wants to give a result back to the first. The target set here is retained across instances via `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#putFragment(android.os.Bundle,java.lang.String,androidx.fragment.app.Fragment)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/fragment/app/Fragment fragment` | The fragment that is the target of this one. |
| `int requestCode` | Optional request code, for convenience if you are going to call back with `https://developer.android.com/reference/androidx/fragment/app/Fragment#onActivityResult(int,int,android.content.Intent)`. |

### setUserVisibleHint

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void [setUserVisibleHint](https://developer.android.com/reference/androidx/fragment/app/Fragment#setUserVisibleHint(boolean))(boolean isVisibleToUser)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> If you are manually calling this method, use `https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction#setMaxLifecycle(androidx.fragment.app.Fragment,androidx.lifecycle.Lifecycle.State)` instead. If overriding this method, behavior implemented when passing in `true` should be moved to `https://developer.android.com/reference/androidx/fragment/app/Fragment#onResume()`, and behavior implemented when passing in `false` should be moved to `https://developer.android.com/reference/androidx/fragment/app/Fragment#onPause()`.

Set a hint to the system about whether this fragment's UI is currently visible to the user. This hint defaults to true and is persistent across fragment instance state save and restore.

An app may set this to false to indicate that the fragment's UI is scrolled out of visibility or is otherwise not directly visible to the user. This may be used by the system to prioritize operations such as fragment lifecycle updates or loader ordering behavior.

**Note:** This method may be called outside of the fragment lifecycle. and thus has no ordering guarantees with regard to fragment lifecycle method calls.

| Parameters |
|---|---|
| `boolean isVisibleToUser` | true if this fragment's UI is currently visible to the user (default), false if it is not. |

### shouldShowRequestPermissionRationale

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public boolean shouldShowRequestPermissionRationale(@NonNull String permission)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html permission` | A permission your app wants to request. |

| Returns |
|---|---|
| `boolean` | Whether you should show permission rationale UI. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html#checkSelfPermission(java.lang.String)` |   |
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#requestPermissions(java.lang.String[],int)` |   |
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#onRequestPermissionsResult(int,java.lang.String[],int[])` |   |

### startActivity

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void startActivity(@NonNull Intent intent)
```

Call `https://developer.android.com/reference/android/app/Activity.html#startActivity(android.content.Intent)` from the fragment's containing Activity.

### startActivity

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void startActivity(@NonNull Intent intent, @Nullable Bundle options)
```

Call `https://developer.android.com/reference/android/app/Activity.html#startActivity(android.content.Intent, android.os.Bundle)` from the fragment's containing Activity.

### startActivityForResult

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.3.0)

```
public void [startActivityForResult](https://developer.android.com/reference/androidx/fragment/app/Fragment#startActivityForResult(android.content.Intent,int))(@NonNull Intent intent, int requestCode)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment. Use `https://developer.android.com/reference/androidx/fragment/app/Fragment#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract<I,O>,androidx.activity.result.ActivityResultCallback<O>)` passing in a `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts.StartActivityForResult` object for the `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract`.

Call `https://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int)` from the fragment's containing Activity.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent` | The intent to start. |
| `int requestCode` | The request code to be returned in `https://developer.android.com/reference/androidx/fragment/app/Fragment#onActivityResult(int,int,android.content.Intent)` when the activity exits. Must be between 0 and 65535 to be considered valid. If given requestCode is greater than 65535, an IllegalArgumentException would be thrown. |

### startActivityForResult

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.3.0)

```
public void [startActivityForResult](https://developer.android.com/reference/androidx/fragment/app/Fragment#startActivityForResult(android.content.Intent,int,android.os.Bundle))(
    @NonNull Intent intent,
    int requestCode,
    @Nullable Bundle options
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment. Use `https://developer.android.com/reference/androidx/fragment/app/Fragment#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract<I,O>,androidx.activity.result.ActivityResultCallback<O>)` passing in a `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts.StartActivityForResult` object for the `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract`.

Call `https://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int, android.os.Bundle)` from the fragment's containing Activity.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Intent.html intent` | The intent to start. |
| `int requestCode` | The request code to be returned in `https://developer.android.com/reference/androidx/fragment/app/Fragment#onActivityResult(int,int,android.content.Intent)` when the activity exits. Must be between 0 and 65535 to be considered valid. If given requestCode is greater than 65535, an IllegalArgumentException would be thrown. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html options` | Additional options for how the Activity should be started. See `https://developer.android.com/reference/android/content/Context.html#startActivity(android.content.Intent, android.os.Bundle)` for more details. This value may be null. |

### startIntentSenderForResult

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.3.0)

```
public void [startIntentSenderForResult](https://developer.android.com/reference/androidx/fragment/app/Fragment#startIntentSenderForResult(android.content.IntentSender,int,android.content.Intent,int,int,int,android.os.Bundle))(
    @NonNull IntentSender intent,
    int requestCode,
    @Nullable Intent fillInIntent,
    int flagsMask,
    int flagsValues,
    int extraFlags,
    @Nullable Bundle options
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract` and the prebuilt contracts for common intents available in `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts`, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment. Use `https://developer.android.com/reference/androidx/fragment/app/Fragment#registerForActivityResult(androidx.activity.result.contract.ActivityResultContract<I,O>,androidx.activity.result.ActivityResultCallback<O>)` passing in a `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts.StartIntentSenderForResult` object for the `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContract`.

Call `https://developer.android.com/reference/android/app/Activity.html#startIntentSenderForResult(android.content.IntentSender, int, android.content.Intent, int, int, int, android.os.Bundle)` from the fragment's containing Activity.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/IntentSender.html intent` | The IntentSender to launch. |
| `int requestCode` | The request code to be returned in `https://developer.android.com/reference/androidx/fragment/app/Fragment#onActivityResult(int,int,android.content.Intent)` when the activity exits. Must be between 0 and 65535 to be considered valid. If given requestCode is greater than 65535, an IllegalArgumentException would be thrown. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/Intent.html fillInIntent` | If non-null, this will be provided as the intent parameter to `https://developer.android.com/reference/android/content/IntentSender.html#sendIntent(android.content.Context, int, android.content.Intent, android.content.IntentSender.OnFinished, android.os.Handler)`. This value may be null. |
| `int flagsMask` | Intent flags in the original IntentSender that you would like to change. |
| `int flagsValues` | Desired values for any bits set in `flagsMask`. |
| `int extraFlags` | Always set to 0. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html options` | Additional options for how the Activity should be started. See `https://developer.android.com/reference/android/content/Context.html#startActivity(android.content.Intent, android.os.Bundle)` for more details. This value may be null. |

| Throws |
|---|---|
| `https://developer.android.com/reference/android/content/IntentSender.SendIntentException.html` |   |

### startPostponedEnterTransition

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void startPostponedEnterTransition()
```

Begin postponed transitions after `https://developer.android.com/reference/androidx/fragment/app/Fragment#postponeEnterTransition()` was called. If postponeEnterTransition() was called, you must call startPostponedEnterTransition() or `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#executePendingTransactions()` to complete the FragmentTransaction. If postponement was interrupted with `https://developer.android.com/reference/androidx/fragment/app/FragmentManager#executePendingTransactions()`, before `startPostponedEnterTransition()`, animations may not run or may execute improperly.

| See also |
|---|---|
| `https://developer.android.com/reference/android/app/Activity.html#startPostponedEnterTransition()` |   |

### toString

```
public @NonNull String toString()
```

### unregisterForContextMenu

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/fragment#1.1.0)

```
public void unregisterForContextMenu(@NonNull View view)
```

Prevents a context menu to be shown for the given view. This method will remove the `https://developer.android.com/reference/android/view/View.OnCreateContextMenuListener.html` on the view.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/View.html view` | The view that should stop showing a context menu. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/Fragment#registerForContextMenu(android.view.View)` |   |

## Extension functions

### AuthenticationUtils.registerForAuthenticationResult

Artifact: [androidx.biometric:biometric](https://developer.android.com/jetpack/androidx/releases/biometric) [View Source](https://cs.android.com/search?q=file:androidx/biometric/AuthenticationExtensions.kt+function:registerForAuthenticationResult)

```
public final @NonNull AuthenticationResultLauncher AuthenticationUtils.registerForAuthenticationResult(
    @NonNull Fragment receiver,
    @NonNull AuthenticationResultCallback resultCallback
)
```

Returns an `https://developer.android.com/reference/androidx/biometric/AuthenticationResultLauncher` that can be used to initiate authentication.

A success or error result will be delivered to `https://developer.android.com/reference/androidx/biometric/AuthenticationResultCallback#onAuthResult(androidx.biometric.AuthenticationResult)` and (one or more) failures will be delivered to `https://developer.android.com/reference/androidx/biometric/AuthenticationResultCallback#onAuthAttemptFailed()`, which is set by `https://developer.android.com/reference/androidx/biometric/package-summary#(androidx.fragment.app.Fragment).registerForAuthenticationResult(androidx.biometric.AuthenticationResultCallback)`. The callback will be executed on the main thread.

This *must* be called unconditionally, as part of initialization path, typically as a field initializer of an Fragment.

Note that if multiple calls to this method are made within a single Fragment or Activity, only the callback registered by the last invocation will be saved and receive authentication results. This can result in unexpected behavior if you intend to manage multiple independent authentication flows. It is strongly recommended to avoid multiple calls to this method in such scenarios.

```kotlin
import androidx.biometric.AuthenticationRequest
import androidx.biometric.AuthenticationRequest.Biometric
import androidx.biometric.AuthenticationRequest.Companion.biometricRequest
import androidx.biometric.AuthenticationResult
import androidx.biometric.PromptContentItemBulletedText
import androidx.biometric.registerForAuthenticationResult
import androidx.fragment.app.Fragment

class MyFragmentForBiometricAuth : Fragment() {
    val requestAuthentication =
        registerForAuthenticationResult { result: AuthenticationResult ->
            when (result) {
                // Handle successful authentication
                is AuthenticationResult.Success -> {
                    Log.i(TAG, "onAuthenticationSucceeded with type ${result.authType}")
                }
                // Handle authentication error, e.g. user cancellation, lockout errors, etc
                is AuthenticationResult.Error -> {
                    Log.i(
                        TAG,
                        "onAuthenticationError " +
                            "with error code: ${result.errorCode} " +
                            "and error string: ${result.errString}",
                    )
                }
                // Handle fallback option clicks
                is AuthenticationResult.CustomFallbackSelected -> {
                    Log.i(TAG, "fallback is selected, text: ${result.fallback.text}")
                }
            }
        }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val authRequest =
            biometricRequest(
                title = "Title",
                Biometric.Fallback.DeviceCredential,
                Biometric.Fallback.CustomOption(
                    text = "Use account password",
                    iconType = Biometric.Fallback.ICON_TYPE_PASSWORD,
                ),
            ) {
                setSubtitle("Subtitle")
                setContent(
                    AuthenticationRequest.BodyContent.VerticalList(
                        "Vertical list description",
                        listOf(
                            PromptContentItemBulletedText("test item1"),
                            PromptContentItemBulletedText("test item2"),
                        ),
                    )
                )
                setMinStrength(Biometric.Strength.Class2)
                setIsConfirmationRequired(true)
            }

        Button(context).setOnClickListener { requestAuthentication.launch(authRequest) }
    }
}
```

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/biometric/package-summary#(androidx.fragment.app.Fragment).registerForAuthenticationResult(java.util.concurrent.Executor,androidx.biometric.AuthenticationResultCallback)` | (Executor, AuthenticationResultCallback) |

### AuthenticationUtils.registerForAuthenticationResult

Artifact: [androidx.biometric:biometric](https://developer.android.com/jetpack/androidx/releases/biometric) [View Source](https://cs.android.com/search?q=file:androidx/biometric/AuthenticationExtensions.kt+function:registerForAuthenticationResult)

```
public final @NonNull AuthenticationResultLauncher AuthenticationUtils.registerForAuthenticationResult(
    @NonNull Fragment receiver,
    @NonNull Executor callbackExecutor,
    @NonNull AuthenticationResultCallback resultCallback
)
```

Returns an `https://developer.android.com/reference/androidx/biometric/AuthenticationResultLauncher` that can be used to initiate authentication.

A success or error result will be delivered to `https://developer.android.com/reference/androidx/biometric/AuthenticationResultCallback#onAuthResult(androidx.biometric.AuthenticationResult)` and (one or more) failures will be delivered to `https://developer.android.com/reference/androidx/biometric/AuthenticationResultCallback#onAuthAttemptFailed()`, which is set by `https://developer.android.com/reference/androidx/biometric/package-summary#(androidx.fragment.app.Fragment).registerForAuthenticationResult(java.util.concurrent.Executor,androidx.biometric.AuthenticationResultCallback)`. The callback will be executed on the thread provided by the `https://developer.android.com/reference/androidx/biometric/package-summary#(androidx.fragment.app.Fragment).registerForAuthenticationResult(java.util.concurrent.Executor,androidx.biometric.AuthenticationResultCallback)`.

This *must* be called unconditionally, as part of initialization path, typically as a field initializer of an Fragment.

Note that if multiple calls to this method are made within a single Fragment or Activity, only the callback registered by the last invocation will be saved and receive authentication results. This can result in unexpected behavior if you intend to manage multiple independent authentication flows. It is strongly recommended to avoid multiple calls to this method in such scenarios.

```kotlin
import androidx.biometric.AuthenticationRequest
import androidx.biometric.AuthenticationRequest.Biometric
import androidx.biometric.AuthenticationRequest.Companion.biometricRequest
import androidx.biometric.AuthenticationResult
import androidx.biometric.PromptContentItemBulletedText
import androidx.biometric.registerForAuthenticationResult
import androidx.fragment.app.Fragment

class MyFragmentForBiometricAuth : Fragment() {
    val requestAuthentication =
        registerForAuthenticationResult { result: AuthenticationResult ->
            when (result) {
                // Handle successful authentication
                is AuthenticationResult.Success -> {
                    Log.i(TAG, "onAuthenticationSucceeded with type ${result.authType}")
                }
                // Handle authentication error, e.g. user cancellation, lockout errors, etc
                is AuthenticationResult.Error -> {
                    Log.i(
                        TAG,
                        "onAuthenticationError " +
                            "with error code: ${result.errorCode} " +
                            "and error string: ${result.errString}",
                    )
                }
                // Handle fallback option clicks
                is AuthenticationResult.CustomFallbackSelected -> {
                    Log.i(TAG, "fallback is selected, text: ${result.fallback.text}")
                }
            }
        }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val authRequest =
            biometricRequest(
                title = "Title",
                Biometric.Fallback.DeviceCredential,
                Biometric.Fallback.CustomOption(
                    text = "Use account password",
                    iconType = Biometric.Fallback.ICON_TYPE_PASSWORD,
                ),
            ) {
                setSubtitle("Subtitle")
                setContent(
                    AuthenticationRequest.BodyContent.VerticalList(
                        "Vertical list description",
                        listOf(
                            PromptContentItemBulletedText("test item1"),
                            PromptContentItemBulletedText("test item2"),
                        ),
                    )
                )
                setMinStrength(Biometric.Strength.Class2)
                setIsConfirmationRequired(true)
            }

        Button(context).setOnClickListener { requestAuthentication.launch(authRequest) }
    }
}
```

### FragmentKt.clearFragmentResult

Artifact: [androidx.fragment:fragment](https://developer.android.com/jetpack/androidx/releases/fragment) [View Source](https://cs.android.com/search?q=file:androidx/fragment/app/Fragment.kt+function:clearFragmentResult)

```
public final void FragmentKt.clearFragmentResult(
    @NonNull Fragment receiver,
    @NonNull String requestKey
)
```

Clears the stored result for the given requestKey.

This clears a result that was previously set a call to `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).setFragmentResult(kotlin.String,android.os.Bundle)`.

If this is called with a requestKey that is not associated with any result, this method does nothing.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html requestKey` | key used to identify the result |

### FragmentKt.clearFragmentResultListener

Artifact: [androidx.fragment:fragment](https://developer.android.com/jetpack/androidx/releases/fragment) [View Source](https://cs.android.com/search?q=file:androidx/fragment/app/Fragment.kt+function:clearFragmentResultListener)

```
public final void FragmentKt.clearFragmentResultListener(
    @NonNull Fragment receiver,
    @NonNull String requestKey
)
```

Clears the stored `https://developer.android.com/reference/androidx/fragment/app/FragmentResultListener` for the given requestKey.

This clears a `https://developer.android.com/reference/androidx/fragment/app/FragmentResultListener` that was previously set a call to `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).setFragmentResultListener(kotlin.String,kotlin.Function2)`.

If this is called with a requestKey that is not associated with any `https://developer.android.com/reference/androidx/fragment/app/FragmentResultListener`, this method does nothing.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html requestKey` | key used to identify the result |

### FragmentKt.findNavController

Artifact: [androidx.navigation:navigation-fragment](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/fragment/Fragment.kt+function:findNavController)

```
public final @NonNull NavController FragmentKt.findNavController(@NonNull Fragment receiver)
```

Find a `https://developer.android.com/reference/androidx/navigation/NavController` given a `https://developer.android.com/reference/androidx/fragment/app/Fragment`

Calling this on a Fragment that is not a `https://developer.android.com/reference/androidx/navigation/fragment/NavHostFragment` or within a `https://developer.android.com/reference/androidx/navigation/fragment/NavHostFragment` will result in an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html`

### FragmentKt.setFragmentResult

Artifact: [androidx.fragment:fragment](https://developer.android.com/jetpack/androidx/releases/fragment) [View Source](https://cs.android.com/search?q=file:androidx/fragment/app/Fragment.kt+function:setFragmentResult)

```
public final void FragmentKt.setFragmentResult(
    @NonNull Fragment receiver,
    @NonNull String requestKey,
    @NonNull Bundle result
)
```

Sets the given result for the `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).setFragmentResult(kotlin.String,android.os.Bundle)`. This result will be delivered to a `https://developer.android.com/reference/androidx/fragment/app/FragmentResultListener` that is called given to `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).setFragmentResultListener(kotlin.String,kotlin.Function2)` with the same `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).setFragmentResult(kotlin.String,android.os.Bundle)`. If no `https://developer.android.com/reference/androidx/fragment/app/FragmentResultListener` with the same key is set or the Lifecycle associated with the listener is not at least `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED`, the result is stored until one becomes available, or `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).clearFragmentResult(kotlin.String)` is called with the same requestKey.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html requestKey` | key used to identify the result |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html result` | the result to be passed to another fragment. |

### FragmentKt.setFragmentResultListener

Artifact: [androidx.fragment:fragment](https://developer.android.com/jetpack/androidx/releases/fragment) [View Source](https://cs.android.com/search?q=file:androidx/fragment/app/Fragment.kt+function:setFragmentResultListener)

```
public final void FragmentKt.setFragmentResultListener(
    @NonNull Fragment receiver,
    @NonNull String requestKey,
    @NonNull Function2<@NonNull String, @NonNull Bundle, Unit> listener
)
```

Sets the `https://developer.android.com/reference/androidx/fragment/app/FragmentResultListener` for a given `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).setFragmentResultListener(kotlin.String,kotlin.Function2)`. Once this Fragment is at least in the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#STARTED` state, any results set by `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).setFragmentResult(kotlin.String,android.os.Bundle)` using the same `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).setFragmentResultListener(kotlin.String,kotlin.Function2)` will be delivered to the `https://developer.android.com/reference/androidx/fragment/app/FragmentResultListener#onFragmentResult(java.lang.String,android.os.Bundle)` callback. The callback will remain active until this Fragment reaches the `https://developer.android.com/reference/androidx/lifecycle/Lifecycle.State#DESTROYED` state or `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).clearFragmentResultListener(kotlin.String)` is called with the same requestKey.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull requestKey: @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | requestKey used to store the result |
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function2<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> listener` | listener for result changes. |

### FragmentNavArgsLazyKt.navArgs

Artifact: [androidx.navigation:navigation-fragment](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/fragment/FragmentNavArgsLazy.kt+function:navArgs)

```
@MainThread
public final @NonNull NavArgsLazy<@NonNull Args> <Args extends NavArgs> FragmentNavArgsLazyKt.navArgs(@NonNull Fragment receiver)
```

Returns a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-lazy/index.html` delegate to access the Fragment's arguments as an `https://developer.android.com/reference/androidx/navigation/fragment/package-summary#(androidx.fragment.app.Fragment).navArgs()` instance.

It is strongly recommended that this method only be used when the Fragment is created by `https://developer.android.com/reference/androidx/navigation/NavController#navigate(kotlin.Int)` with the corresponding `https://developer.android.com/reference/androidx/navigation/NavDirections` object, which ensures that the required arguments are present.

```
class MyFragment : Fragment() {
    val args: MyFragmentArgs by navArgs()
}
```

This property can be accessed only after the Fragment's constructor.

### FragmentViewModelLazyKt.activityViewModels

Artifact: [androidx.fragment:fragment](https://developer.android.com/jetpack/androidx/releases/fragment) [View Source](https://cs.android.com/search?q=file:androidx/fragment/app/FragmentViewModelLazy.kt+function:activityViewModels)

```
@MainThread
public final @NonNull Lazy<@NonNull VM> <VM extends ViewModel> FragmentViewModelLazyKt.activityViewModels(
    @NonNull Fragment receiver,
    Function0<@NonNull CreationExtras> extrasProducer,
    Function0<@NonNull ViewModelProvider.Factory> factoryProducer
)
```

Returns a property delegate to access parent activity's `https://developer.android.com/reference/androidx/lifecycle/ViewModel`, if `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).activityViewModels(kotlin.Function0,kotlin.Function0)` is specified then `https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory` returned by it will be used to create `https://developer.android.com/reference/androidx/lifecycle/ViewModel` first time. Otherwise, the activity's default factory will be used.

```
class MyFragment : Fragment() {
    val viewmodel: MyViewModel by activityViewModels()
}
```

This property can be accessed only after this Fragment is attached i.e., after Fragment.onAttach(), and access prior to that will result in IllegalArgumentException.

### FragmentViewModelLazyKt.createViewModelLazy

Artifact: [androidx.fragment:fragment](https://developer.android.com/jetpack/androidx/releases/fragment) [View Source](https://cs.android.com/search?q=file:androidx/fragment/app/FragmentViewModelLazy.kt+function:createViewModelLazy)

```
@MainThread
public final @NonNull Lazy<@NonNull VM> <VM extends ViewModel> FragmentViewModelLazyKt.createViewModelLazy(
    @NonNull Fragment receiver,
    @NonNull KClass<@NonNull VM> viewModelClass,
    @NonNull Function0<@NonNull ViewModelStore> storeProducer,
    @NonNull Function0<@NonNull CreationExtras> extrasProducer,
    Function0<@NonNull ViewModelProvider.Factory> factoryProducer
)
```

Helper method for creation of `https://developer.android.com/reference/androidx/lifecycle/ViewModelLazy`, that resolves `null` passed as `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).createViewModelLazy(kotlin.reflect.KClass,kotlin.Function0,kotlin.Function0,kotlin.Function0)` to the default factory.

This method also takes a `https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras` producer that provides default extras to the created `https://developer.android.com/reference/androidx/lifecycle/ViewModel`.

### FragmentViewModelLazyKt.viewModels

Artifact: [androidx.fragment:fragment](https://developer.android.com/jetpack/androidx/releases/fragment) [View Source](https://cs.android.com/search?q=file:androidx/fragment/app/FragmentViewModelLazy.kt+function:viewModels)

```
@MainThread
public final @NonNull Lazy<@NonNull VM> <VM extends ViewModel> FragmentViewModelLazyKt.viewModels(
    @NonNull Fragment receiver,
    @NonNull Function0<@NonNull ViewModelStoreOwner> ownerProducer,
    Function0<@NonNull CreationExtras> extrasProducer,
    Function0<@NonNull ViewModelProvider.Factory> factoryProducer
)
```

Returns a property delegate to access `https://developer.android.com/reference/androidx/lifecycle/ViewModel` by **default** scoped to this `https://developer.android.com/reference/androidx/fragment/app/Fragment`:

```
class MyFragment : Fragment() {
    val viewmodel: MyViewModel by viewModels()
}
```

Custom `https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory` can be defined via `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).viewModels(kotlin.Function0,kotlin.Function0,kotlin.Function0)` parameter, factory returned by it will be used to create `https://developer.android.com/reference/androidx/lifecycle/ViewModel`:

```
class MyFragment : Fragment() {
    val viewmodel: MyViewModel by viewModels { myFactory }
}
```

Default scope may be overridden with parameter `https://developer.android.com/reference/androidx/fragment/app/package-summary#(androidx.fragment.app.Fragment).viewModels(kotlin.Function0,kotlin.Function0,kotlin.Function0)`:

```
class MyFragment : Fragment() {
    val viewmodel: MyViewModel by viewModels ({requireParentFragment()})
}
```

This property can be accessed only after this Fragment is attached i.e., after Fragment.onAttach(), and access prior to that will result in IllegalArgumentException.

### HiltNavGraphViewModelLazyKt.hiltNavGraphViewModels

Artifact: [androidx.hilt:hilt-navigation-fragment](https://developer.android.com/jetpack/androidx/releases/hilt) [View Source](https://cs.android.com/search?q=file:androidx/hilt/navigation/fragment/HiltNavGraphViewModelLazy.kt+function:hiltNavGraphViewModels)

```
@MainThread
public final @NonNull Lazy<@NonNull VM> <VM extends ViewModel> HiltNavGraphViewModelLazyKt.hiltNavGraphViewModels(
    @NonNull Fragment receiver,
    @IdRes int navGraphId
)
```

Returns a property delegate to access a [HiltViewModel](https://dagger.dev/api/latest/dagger/hilt/android/lifecycle/HiltViewModel) -annotated `https://developer.android.com/reference/androidx/lifecycle/ViewModel` scoped to a navigation graph present on the `https://developer.android.com/reference/androidx/navigation/NavController` back stack:

```
class MyFragment : Fragment() {
    val viewmodel: MainViewModel by hiltNavGraphViewModels(R.navigation.main)
}
```

This property can be accessed only after this NavGraph is on the NavController back stack, and an attempt access prior to that will result in an IllegalArgumentException.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IdRes int navGraphId` | ID of a NavGraph that exists on the `https://developer.android.com/reference/androidx/navigation/NavController` back stack |

### HiltNavGraphViewModelLazyKt.hiltNavGraphViewModels

Artifact: [androidx.hilt:hilt-navigation-fragment](https://developer.android.com/jetpack/androidx/releases/hilt) [View Source](https://cs.android.com/search?q=file:androidx/hilt/navigation/fragment/HiltNavGraphViewModelLazy.kt+function:hiltNavGraphViewModels)

```
@MainThread
public final @NonNull Lazy<@NonNull VM> <VM extends ViewModel, VMF extends Object> HiltNavGraphViewModelLazyKt.hiltNavGraphViewModels(
    @NonNull Fragment receiver,
    @IdRes int navGraphId,
    @NonNull Function1<@NonNull VMF, @NonNull VM> creationCallback
)
```

Returns a property delegate to access a [HiltViewModel](https://dagger.dev/api/latest/dagger/hilt/android/lifecycle/HiltViewModel) -annotated `https://developer.android.com/reference/androidx/lifecycle/ViewModel` with an @AssistedInject-annotated constructor that is scoped to a navigation graph present on the `https://developer.android.com/reference/androidx/navigation/NavController` back stack:

```
class MyFragment : Fragment() {
    val viewmodel: MainViewModel by hiltNavGraphViewModels(R.navigation.main) { factory: MainViewModelFactory ->
        factory.create(...)
    }
}
```

This property can be accessed only after this NavGraph is on the NavController back stack, and an attempt access prior to that will result in an IllegalArgumentException.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IdRes int navGraphId` | ID of a NavGraph that exists on the `https://developer.android.com/reference/androidx/navigation/NavController` back stack |
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull VMF, @https://developer.android.com/reference/androidx/annotation/NonNull VM> creationCallback` | callback that takes an @AssistedFactory-annotated factory and creates a HiltViewModel using @AssistedInject-annotated constructor. |

### NavGraphViewModelLazyKt.navGraphViewModels

Artifact: [androidx.navigation:navigation-fragment](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavGraphViewModelLazy.kt+function:navGraphViewModels)

```
@MainThread
public final @NonNull Lazy<@NonNull VM> <VM extends ViewModel> NavGraphViewModelLazyKt.navGraphViewModels(
    @NonNull Fragment receiver,
    @IdRes int navGraphId,
    Function0<@NonNull CreationExtras> extrasProducer,
    Function0<@NonNull ViewModelProvider.Factory> factoryProducer
)
```

Returns a property delegate to access a `https://developer.android.com/reference/androidx/lifecycle/ViewModel` scoped to a navigation graph present on the `https://developer.android.com/reference/androidx/navigation/NavController` back stack:

```
class MyFragment : Fragment() {
    val viewmodel: MainViewModel by navGraphViewModels(R.id.main)
}
```

Custom `https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory` can be defined via `https://developer.android.com/reference/androidx/navigation/package-summary#(androidx.fragment.app.Fragment).navGraphViewModels(kotlin.Int,kotlin.Function0,kotlin.Function0)` parameter, factory returned by it will be used to create `https://developer.android.com/reference/androidx/lifecycle/ViewModel`:

```
class MyFragment : Fragment() {
    val viewmodel: MainViewModel by navGraphViewModels(R.id.main) { myFactory }
}
```

This property can be accessed only after this NavGraph is on the NavController back stack, and an attempt access prior to that will result in an IllegalArgumentException.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IdRes int navGraphId` | ID of a NavGraph that exists on the `https://developer.android.com/reference/androidx/navigation/NavController` back stack |
| `Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras> extrasProducer` | lambda that will be called during initialization to return `https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras`. If none is provided, this will use the extras from the `https://developer.android.com/reference/androidx/navigation/NavBackStackEntry` referenced by the `https://developer.android.com/reference/androidx/navigation/package-summary#(androidx.fragment.app.Fragment).navGraphViewModels(kotlin.Int,kotlin.Function0,kotlin.Function0)`. |
| `Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory> factoryProducer` | lambda that will be called during initialization to return `https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory`. If none is provided, this will use the factory from the `https://developer.android.com/reference/androidx/navigation/NavBackStackEntry` referenced by the `https://developer.android.com/reference/androidx/navigation/package-summary#(androidx.fragment.app.Fragment).navGraphViewModels(kotlin.Int,kotlin.Function0,kotlin.Function0)`. |

### NavGraphViewModelLazyKt.navGraphViewModels

Artifact: [androidx.navigation:navigation-fragment](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavGraphViewModelLazy.kt+function:navGraphViewModels)

```
@MainThread
public final @NonNull Lazy<@NonNull VM> <VM extends ViewModel> NavGraphViewModelLazyKt.navGraphViewModels(
    @NonNull Fragment receiver,
    @NonNull String navGraphRoute,
    Function0<@NonNull CreationExtras> extrasProducer,
    Function0<@NonNull ViewModelProvider.Factory> factoryProducer
)
```

Returns a property delegate to access a `https://developer.android.com/reference/androidx/lifecycle/ViewModel` scoped to a navigation graph present on the `https://developer.android.com/reference/androidx/navigation/NavController` back stack:

```
class MyFragment : Fragment() {
    val viewModel: MainViewModel by navGraphViewModels("main")
}
```

Custom `https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory` can be defined via `https://developer.android.com/reference/androidx/navigation/package-summary#(androidx.fragment.app.Fragment).navGraphViewModels(kotlin.String,kotlin.Function0,kotlin.Function0)` parameter, factory returned by it will be used to create `https://developer.android.com/reference/androidx/lifecycle/ViewModel`:

```
class MyFragment : Fragment() {
    val viewModel: MainViewModel by navGraphViewModels("main") { myFactory }
}
```

This property can be accessed only after this NavGraph is on the NavController back stack, and an attempt access prior to that will result in an IllegalArgumentException.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html navGraphRoute` | `https://developer.android.com/reference/androidx/navigation/NavDestination#route()` of a NavGraph that exists on the `https://developer.android.com/reference/androidx/navigation/NavController` back stack. If a `https://developer.android.com/reference/androidx/navigation/NavDestination` with the given route does not exist on the back stack, an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` will be thrown. |
| `Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras> extrasProducer` | lambda that will be called during initialization to return `https://developer.android.com/reference/androidx/lifecycle/viewmodel/CreationExtras`. If none is provided, this will use the extras from the `https://developer.android.com/reference/androidx/navigation/NavBackStackEntry` referenced by the `https://developer.android.com/reference/androidx/navigation/package-summary#(androidx.fragment.app.Fragment).navGraphViewModels(kotlin.String,kotlin.Function0,kotlin.Function0)`. |
| `Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory> factoryProducer` | lambda that will be called during initialization to return `https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider.Factory`. If none is provided, this will use the factory from the `https://developer.android.com/reference/androidx/navigation/NavBackStackEntry` referenced by the `https://developer.android.com/reference/androidx/navigation/package-summary#(androidx.fragment.app.Fragment).navGraphViewModels(kotlin.String,kotlin.Function0,kotlin.Function0)`. |