# FragmentController

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

*** ** * ** ***

<br />

```
public class FragmentController
```

<br />

*** ** * ** ***

Provides integration points with a `https://developer.android.com/reference/androidx/fragment/app/FragmentManager` for a fragment host.

It is the responsibility of the host to take care of the Fragment's lifecycle. The methods provided by `https://developer.android.com/reference/androidx/fragment/app/FragmentController` are for that purpose.

## Summary

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/fragment/app/FragmentController#attachHost(androidx.fragment.app.Fragment)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/fragment/app/Fragment parent)` Attaches the host to the FragmentManager for this controller. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/fragment/app/FragmentController` | `https://developer.android.com/reference/androidx/fragment/app/FragmentController#createController(androidx.fragment.app.FragmentHostCallback<?>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback<@https://developer.android.com/reference/androidx/annotation/NonNull ?> callbacks)` Returns a `https://developer.android.com/reference/androidx/fragment/app/FragmentController`. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchActivityCreated()()` Moves all Fragments managed by the controller's FragmentManager into the activity created state. |
| `void` | `[dispatchConfigurationChanged](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchConfigurationChanged(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)` **This method is deprecated.** Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/core/content/OnConfigurationChangedProvider` to automatically dispatch configuration changes to fragments. <br /> |
| `boolean` | `https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchContextItemSelected(android.view.MenuItem)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/MenuItem.html item)` Sends a context item selection event to the Fragments managed by the controller's FragmentManager. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchCreate()()` Moves all Fragments managed by the controller's FragmentManager into the create state. |
| `boolean` | `[dispatchCreateOptionsMenu](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchCreateOptionsMenu(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.** Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/core/view/MenuHost` to automatically dispatch menu changes to fragments. <br /> |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchDestroy()()` Moves Fragments managed by the controller's FragmentManager into the destroy state. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchDestroyView()()` Moves all Fragments managed by the controller's FragmentManager into the destroy view state. |
| `void` | `[dispatchLowMemory](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchLowMemory())()` **This method is deprecated.** Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/core/content/OnTrimMemoryProvider` to automatically dispatch low memory callbacks to fragments. <br /> |
| `void` | `[dispatchMultiWindowModeChanged](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchMultiWindowModeChanged(boolean))(boolean isInMultiWindowMode)` **This method is deprecated.** Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/core/app/OnMultiWindowModeChangedProvider` to automatically dispatch multi-window mode changes to fragments. <br /> |
| `boolean` | `[dispatchOptionsItemSelected](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchOptionsItemSelected(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.** Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/core/view/MenuHost` to automatically dispatch menu changes to fragments. <br /> |
| `void` | `[dispatchOptionsMenuClosed](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchOptionsMenuClosed(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.** Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/core/view/MenuHost` to automatically dispatch menu changes to fragments. <br /> |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchPause()()` Moves all Fragments managed by the controller's FragmentManager into the pause state. |
| `void` | `[dispatchPictureInPictureModeChanged](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchPictureInPictureModeChanged(boolean))(boolean isInPictureInPictureMode)` **This method is deprecated.** Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/core/app/OnPictureInPictureModeChangedProvider` to automatically dispatch picture-in-picture mode changes to fragments. <br /> |
| `boolean` | `[dispatchPrepareOptionsMenu](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchPrepareOptionsMenu(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.** Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/core/view/MenuHost` to automatically dispatch menu changes to fragments. <br /> |
| `void` | `[dispatchReallyStop](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchReallyStop())()` **This method is deprecated.** This functionality has been rolled into `https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchStop()`. <br /> |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchResume()()` Moves all Fragments managed by the controller's FragmentManager into the resume state. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchStart()()` Moves all Fragments managed by the controller's FragmentManager into the start state. |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchStop()()` Moves all Fragments managed by the controller's FragmentManager into the stop state. |
| `void` | `[doLoaderDestroy](https://developer.android.com/reference/androidx/fragment/app/FragmentController#doLoaderDestroy())()` **This method is deprecated.** Loaders are managed separately from FragmentController <br /> |
| `void` | `[doLoaderRetain](https://developer.android.com/reference/androidx/fragment/app/FragmentController#doLoaderRetain())()` **This method is deprecated.** Loaders are managed separately from FragmentController <br /> |
| `void` | `[doLoaderStart](https://developer.android.com/reference/androidx/fragment/app/FragmentController#doLoaderStart())()` **This method is deprecated.** Loaders are managed separately from FragmentController <br /> |
| `void` | `[doLoaderStop](https://developer.android.com/reference/androidx/fragment/app/FragmentController#doLoaderStop(boolean))(boolean retain)` **This method is deprecated.** Loaders are managed separately from FragmentController <br /> |
| `void` | `[dumpLoaders](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dumpLoaders(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 )` **This method is deprecated.** Loaders are managed separately from FragmentController <br /> |
| `boolean` | `https://developer.android.com/reference/androidx/fragment/app/FragmentController#execPendingActions()()` Execute any pending actions for the Fragments managed by the controller's FragmentManager. |
| `@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/FragmentController#findFragmentByWho(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html who)` Returns a fragment with the given identifier. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/fragment/app/Fragment>` | `https://developer.android.com/reference/androidx/fragment/app/FragmentController#getActiveFragments(java.util.List<androidx.fragment.app.Fragment>)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/fragment/app/Fragment> actives)` Returns the list of active fragments. |
| `int` | `https://developer.android.com/reference/androidx/fragment/app/FragmentController#getActiveFragmentsCount()()` Returns the number of active fragments. |
| `@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/FragmentController#getSupportFragmentManager()()` Returns a `https://developer.android.com/reference/androidx/fragment/app/FragmentManager` for this controller. |
| `https://developer.android.com/reference/androidx/loader/app/LoaderManager` | `[getSupportLoaderManager](https://developer.android.com/reference/androidx/fragment/app/FragmentController#getSupportLoaderManager())()` **This method is deprecated.** Loaders are managed separately from FragmentController and this now throws an `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html`. <br /> |
| `void` | `https://developer.android.com/reference/androidx/fragment/app/FragmentController#noteStateNotSaved()()` Marks the fragment state as unsaved. |
| `@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/FragmentController#onCreateView(android.view.View,java.lang.String,android.content.Context,android.util.AttributeSet)( @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/view/View.html parent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html name, @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 )` Instantiates a Fragment's view. |
| `void` | `[reportLoaderStart](https://developer.android.com/reference/androidx/fragment/app/FragmentController#reportLoaderStart())()` **This method is deprecated.** Loaders are managed separately from FragmentController <br /> |
| `void` | `[restoreAllState](https://developer.android.com/reference/androidx/fragment/app/FragmentController#restoreAllState(android.os.Parcelable,androidx.fragment.app.FragmentManagerNonConfig))( @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Parcelable.html state, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/fragment/app/FragmentManagerNonConfig nonConfig )` **This method is deprecated.** Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/lifecycle/ViewModelStoreOwner` to automatically restore the Fragment's non configuration state and use `https://developer.android.com/reference/androidx/fragment/app/FragmentController#restoreSaveState(android.os.Parcelable)` to restore the Fragment's save state. <br /> |
| `void` | `[restoreAllState](https://developer.android.com/reference/androidx/fragment/app/FragmentController#restoreAllState(android.os.Parcelable,java.util.List<androidx.fragment.app.Fragment>))( @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Parcelable.html state, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/fragment/app/Fragment> nonConfigList )` **This method is deprecated.** Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/lifecycle/ViewModelStoreOwner` to automatically restore the Fragment's non configuration state and use `https://developer.android.com/reference/androidx/fragment/app/FragmentController#restoreSaveState(android.os.Parcelable)` to restore the Fragment's save state. <br /> |
| `void` | `[restoreLoaderNonConfig](https://developer.android.com/reference/androidx/fragment/app/FragmentController#restoreLoaderNonConfig(androidx.collection.SimpleArrayMap<java.lang.String,androidx.loader.app.LoaderManager>))( https://developer.android.com/reference/androidx/collection/SimpleArrayMap<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/androidx/loader/app/LoaderManager> loaderManagers )` **This method is deprecated.** Loaders are managed separately from FragmentController <br /> |
| `void` | `[restoreSaveState](https://developer.android.com/reference/androidx/fragment/app/FragmentController#restoreSaveState(android.os.Parcelable))(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Parcelable.html state)` **This method is deprecated.** Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/savedstate/SavedStateRegistryOwner` to automatically restore the saved state via the `https://developer.android.com/reference/androidx/fragment/app/FragmentManager`. <br /> |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/collection/SimpleArrayMap<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/androidx/loader/app/LoaderManager>` | `[retainLoaderNonConfig](https://developer.android.com/reference/androidx/fragment/app/FragmentController#retainLoaderNonConfig())()` **This method is deprecated.** Loaders are managed separately from FragmentController <br /> |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/fragment/app/FragmentManagerNonConfig` | `[retainNestedNonConfig](https://developer.android.com/reference/androidx/fragment/app/FragmentController#retainNestedNonConfig())()` **This method is deprecated.** Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/lifecycle/ViewModelStoreOwner` to automatically retain the Fragment's non configuration state. <br /> |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/fragment/app/Fragment>` | `[retainNonConfig](https://developer.android.com/reference/androidx/fragment/app/FragmentController#retainNonConfig())()` **This method is deprecated.** Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/lifecycle/ViewModelStoreOwner` to automatically retain the Fragment's non configuration state. <br /> |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Parcelable.html` | `[saveAllState](https://developer.android.com/reference/androidx/fragment/app/FragmentController#saveAllState())()` **This method is deprecated.** Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/savedstate/SavedStateRegistryOwner` to automatically save state via the `https://developer.android.com/reference/androidx/fragment/app/FragmentManager`. <br /> |

## Public methods

### attachHost

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

```
public void attachHost(@Nullable Fragment parent)
```

Attaches the host to the FragmentManager for this controller. The host must be attached before the FragmentManager can be used to manage Fragments.

### createController

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

```
public static @NonNull FragmentController createController(@NonNull FragmentHostCallback<@NonNull ?> callbacks)
```

Returns a `https://developer.android.com/reference/androidx/fragment/app/FragmentController`.

### dispatchActivityCreated

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

```
public void dispatchActivityCreated()
```

Moves all Fragments managed by the controller's FragmentManager into the activity created state.

Call when Fragments should be informed their host has been created.

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

### dispatchConfigurationChanged

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 [dispatchConfigurationChanged](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchConfigurationChanged(android.content.res.Configuration))(@NonNull Configuration newConfig)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/core/content/OnConfigurationChangedProvider` to automatically dispatch configuration changes to fragments.

Lets all Fragments managed by the controller's FragmentManager know a configuration change occurred.

Call when there is a configuration change.

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

### dispatchContextItemSelected

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

```
public boolean dispatchContextItemSelected(@NonNull MenuItem item)
```

Sends a context item selection event to the Fragments managed by the controller's FragmentManager. Once the event has been consumed, no additional handling will be performed.

Call immediately after an options menu item has been selected

| Returns |
|---|---|
| `boolean` | `true` if the context menu selection event was consumed |

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

### dispatchCreate

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

```
public void dispatchCreate()
```

Moves all Fragments managed by the controller's FragmentManager into the create state.

Call when Fragments should be created.

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

### dispatchCreateOptionsMenu

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 boolean [dispatchCreateOptionsMenu](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchCreateOptionsMenu(android.view.Menu,android.view.MenuInflater))(
    @NonNull Menu menu,
    @NonNull MenuInflater inflater
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/core/view/MenuHost` to automatically dispatch menu changes to fragments.

Lets all Fragments managed by the controller's FragmentManager know they should create an options menu.

Call when the Fragment should create an options menu.

| Returns |
|---|---|
| `boolean` | `true` if the options menu contains items to display |

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

### dispatchDestroy

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

```
public void dispatchDestroy()
```

Moves Fragments managed by the controller's FragmentManager into the destroy state.

If the `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` is an instance of `https://developer.android.com/reference/androidx/lifecycle/ViewModelStoreOwner`, then retained Fragments and any other non configuration state such as any `https://developer.android.com/reference/androidx/lifecycle/ViewModel` attached to Fragments will only be destroyed if `https://developer.android.com/reference/androidx/lifecycle/ViewModelStore#clear()` is called prior to this method.

Otherwise, the FragmentManager will look to see if the `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` Context is an `https://developer.android.com/reference/android/app/Activity.html` and if `https://developer.android.com/reference/android/app/Activity.html#isChangingConfigurations()` returns true. In only that case will non configuration state be retained.

Call when Fragments should be destroyed.

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

### dispatchDestroyView

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

```
public void dispatchDestroyView()
```

Moves all Fragments managed by the controller's FragmentManager into the destroy view state.

Call when the Fragment's views should be destroyed.

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

### dispatchLowMemory

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 [dispatchLowMemory](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchLowMemory())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/core/content/OnTrimMemoryProvider` to automatically dispatch low memory callbacks to fragments.

Lets all Fragments managed by the controller's FragmentManager know the device is in a low memory condition.

Call when the device is low on memory and Fragment's should trim their memory usage.

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

### dispatchMultiWindowModeChanged

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 [dispatchMultiWindowModeChanged](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchMultiWindowModeChanged(boolean))(boolean isInMultiWindowMode)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/core/app/OnMultiWindowModeChangedProvider` to automatically dispatch multi-window mode changes to fragments.

Lets all Fragments managed by the controller's FragmentManager know the multi-window mode of the activity changed.

Call when the multi-window mode of the activity changed.

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

### dispatchOptionsItemSelected

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 boolean [dispatchOptionsItemSelected](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchOptionsItemSelected(android.view.MenuItem))(@NonNull MenuItem item)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/core/view/MenuHost` to automatically dispatch menu changes to fragments.

Sends an option item selection event to the Fragments managed by the controller's FragmentManager. Once the event has been consumed, no additional handling will be performed.

Call immediately after an options menu item has been selected

| Returns |
|---|---|
| `boolean` | `true` if the options menu selection event was consumed |

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

### dispatchOptionsMenuClosed

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 [dispatchOptionsMenuClosed](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchOptionsMenuClosed(android.view.Menu))(@NonNull Menu menu)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/core/view/MenuHost` to automatically dispatch menu changes to fragments.

Lets all Fragments managed by the controller's FragmentManager know their options menu has closed.

Call immediately after closing the Fragment's options menu.

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

### dispatchPause

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

```
public void dispatchPause()
```

Moves all Fragments managed by the controller's FragmentManager into the pause state.

Call when Fragments should be paused.

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

### dispatchPictureInPictureModeChanged

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 [dispatchPictureInPictureModeChanged](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchPictureInPictureModeChanged(boolean))(boolean isInPictureInPictureMode)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/core/app/OnPictureInPictureModeChangedProvider` to automatically dispatch picture-in-picture mode changes to fragments.

Lets all Fragments managed by the controller's FragmentManager know the picture-in-picture mode of the activity changed.

Call when the picture-in-picture mode of the activity changed.

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

### dispatchPrepareOptionsMenu

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 boolean [dispatchPrepareOptionsMenu](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchPrepareOptionsMenu(android.view.Menu))(@NonNull Menu menu)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/core/view/MenuHost` to automatically dispatch menu changes to fragments.

Lets all Fragments managed by the controller's FragmentManager know they should prepare their options menu for display.

Call immediately before displaying the Fragment's options menu.

| Returns |
|---|---|
| `boolean` | `true` if the options menu contains items to display |

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

### dispatchReallyStop

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 [dispatchReallyStop](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchReallyStop())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> This functionality has been rolled into `https://developer.android.com/reference/androidx/fragment/app/FragmentController#dispatchStop()`.

### dispatchResume

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

```
public void dispatchResume()
```

Moves all Fragments managed by the controller's FragmentManager into the resume state.

Call when Fragments should be resumed.

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

### dispatchStart

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

```
public void dispatchStart()
```

Moves all Fragments managed by the controller's FragmentManager into the start state.

Call when Fragments should be started.

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

### dispatchStop

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

```
public void dispatchStop()
```

Moves all Fragments managed by the controller's FragmentManager into the stop state.

Call when Fragments should be stopped.

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

### doLoaderDestroy

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 [doLoaderDestroy](https://developer.android.com/reference/androidx/fragment/app/FragmentController#doLoaderDestroy())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Loaders are managed separately from FragmentController

Destroys the loaders and, if their state is not being retained, removes them.

### doLoaderRetain

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 [doLoaderRetain](https://developer.android.com/reference/androidx/fragment/app/FragmentController#doLoaderRetain())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Loaders are managed separately from FragmentController

Retains the state of each of the loaders.

### doLoaderStart

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 [doLoaderStart](https://developer.android.com/reference/androidx/fragment/app/FragmentController#doLoaderStart())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Loaders are managed separately from FragmentController

Starts the loaders.

### doLoaderStop

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 [doLoaderStop](https://developer.android.com/reference/androidx/fragment/app/FragmentController#doLoaderStop(boolean))(boolean retain)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Loaders are managed separately from FragmentController

Stops the loaders, optionally retaining their state. This is useful for keeping the loader state across configuration changes.

| Parameters |
|---|---|
| `boolean retain` | When `true`, the loaders aren't stopped, but, their instances are retained in a started state |

### dumpLoaders

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 [dumpLoaders](https://developer.android.com/reference/androidx/fragment/app/FragmentController#dumpLoaders(java.lang.String,java.io.FileDescriptor,java.io.PrintWriter,java.lang.String[]))(
    @NonNull String prefix,
    @Nullable FileDescriptor fd,
    @NonNull PrintWriter writer,
    @Nullable String[] args
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Loaders are managed separately from FragmentController

Dumps the current state of the loaders.

### execPendingActions

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

```
public boolean execPendingActions()
```

Execute any pending actions for the Fragments managed by the controller's FragmentManager.

Call when queued actions can be performed \[eg when the Fragment moves into a start or resume state\].

| Returns |
|---|---|
| `boolean` | `true` if queued actions were performed |

### findFragmentByWho

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

```
public @Nullable Fragment findFragmentByWho(@NonNull String who)
```

Returns a fragment with the given identifier.

### getActiveFragments

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

```
public @NonNull List<Fragment> getActiveFragments(List<Fragment> actives)
```

Returns the list of active fragments.

### getActiveFragmentsCount

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

```
public int getActiveFragmentsCount()
```

Returns the number of active fragments.

### getSupportFragmentManager

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

```
public @NonNull FragmentManager getSupportFragmentManager()
```

Returns a `https://developer.android.com/reference/androidx/fragment/app/FragmentManager` for this controller.

### getSupportLoaderManager

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 LoaderManager [getSupportLoaderManager](https://developer.android.com/reference/androidx/fragment/app/FragmentController#getSupportLoaderManager())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Loaders are managed separately from FragmentController and this now throws an `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html`. Use `https://developer.android.com/reference/androidx/loader/app/LoaderManager#getInstance(T)` to obtain a LoaderManager.

Returns a `https://developer.android.com/reference/androidx/loader/app/LoaderManager`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/loader/app/LoaderManager#getInstance(T)` |   |

### noteStateNotSaved

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

```
public void noteStateNotSaved()
```

Marks the fragment state as unsaved. This allows for "state loss" detection.

### onCreateView

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

```
public @Nullable View onCreateView(
    @Nullable View parent,
    @NonNull String name,
    @NonNull Context context,
    @NonNull AttributeSet attrs
)
```

Instantiates a Fragment's view.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/view/View.html parent` | The parent that the created view will be placed in; *note that this may be null*. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html name` | Tag name to be inflated. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | The context the view is being created in. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/util/AttributeSet.html attrs` | Inflation attributes as specified in XML file. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/view/View.html` | view the newly created view |

### reportLoaderStart

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 [reportLoaderStart](https://developer.android.com/reference/androidx/fragment/app/FragmentController#reportLoaderStart())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Loaders are managed separately from FragmentController

Lets the loaders know the host is ready to receive notifications.

### restoreAllState

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 [restoreAllState](https://developer.android.com/reference/androidx/fragment/app/FragmentController#restoreAllState(android.os.Parcelable,androidx.fragment.app.FragmentManagerNonConfig))(
    @Nullable Parcelable state,
    @Nullable FragmentManagerNonConfig nonConfig
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/lifecycle/ViewModelStoreOwner` to automatically restore the Fragment's non configuration state and use `https://developer.android.com/reference/androidx/fragment/app/FragmentController#restoreSaveState(android.os.Parcelable)` to restore the Fragment's save state.

Restores the saved state for all Fragments. The given FragmentManagerNonConfig are Fragment instances retained across configuration changes, including nested fragments

### restoreAllState

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 [restoreAllState](https://developer.android.com/reference/androidx/fragment/app/FragmentController#restoreAllState(android.os.Parcelable,java.util.List<androidx.fragment.app.Fragment>))(
    @Nullable Parcelable state,
    @Nullable List<Fragment> nonConfigList
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/lifecycle/ViewModelStoreOwner` to automatically restore the Fragment's non configuration state and use `https://developer.android.com/reference/androidx/fragment/app/FragmentController#restoreSaveState(android.os.Parcelable)` to restore the Fragment's save state.

Restores the saved state for all Fragments. The given Fragment list are Fragment instances retained across configuration changes.

### restoreLoaderNonConfig

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 [restoreLoaderNonConfig](https://developer.android.com/reference/androidx/fragment/app/FragmentController#restoreLoaderNonConfig(androidx.collection.SimpleArrayMap<java.lang.String,androidx.loader.app.LoaderManager>))(
    SimpleArrayMap<String, LoaderManager> loaderManagers
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Loaders are managed separately from FragmentController

Restores the saved state for all LoaderManagers. The given LoaderManager list are LoaderManager instances retained across configuration changes.

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

### restoreSaveState

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

```
public void [restoreSaveState](https://developer.android.com/reference/androidx/fragment/app/FragmentController#restoreSaveState(android.os.Parcelable))(@Nullable Parcelable state)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/savedstate/SavedStateRegistryOwner` to automatically restore the saved state via the `https://developer.android.com/reference/androidx/fragment/app/FragmentManager`.

Restores the saved state for all Fragments.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Parcelable.html state` | the saved state containing the Parcelable returned by `https://developer.android.com/reference/androidx/fragment/app/FragmentController#saveAllState()` |

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

### retainLoaderNonConfig

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 @Nullable SimpleArrayMap<String, LoaderManager> [retainLoaderNonConfig](https://developer.android.com/reference/androidx/fragment/app/FragmentController#retainLoaderNonConfig())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Loaders are managed separately from FragmentController

Returns a list of LoaderManagers that have opted to retain their instance across configuration changes.

### retainNestedNonConfig

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 @Nullable FragmentManagerNonConfig [retainNestedNonConfig](https://developer.android.com/reference/androidx/fragment/app/FragmentController#retainNestedNonConfig())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/lifecycle/ViewModelStoreOwner` to automatically retain the Fragment's non configuration state.

Returns a nested tree of Fragments that have opted to retain their instance across configuration changes.

### retainNonConfig

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 @Nullable List<Fragment> [retainNonConfig](https://developer.android.com/reference/androidx/fragment/app/FragmentController#retainNonConfig())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/lifecycle/ViewModelStoreOwner` to automatically retain the Fragment's non configuration state.

Returns a list of Fragments that have opted to retain their instance across configuration changes.

### saveAllState

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

```
public @Nullable Parcelable [saveAllState](https://developer.android.com/reference/androidx/fragment/app/FragmentController#saveAllState())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Have your `https://developer.android.com/reference/androidx/fragment/app/FragmentHostCallback` implement `https://developer.android.com/reference/androidx/savedstate/SavedStateRegistryOwner` to automatically save state via the `https://developer.android.com/reference/androidx/fragment/app/FragmentManager`.

Saves the state for all Fragments.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/fragment/app/FragmentController#restoreSaveState(android.os.Parcelable)` |   |