added in version 24.1.0
belongs to Maven artifact com.android.support:support-fragment:28.0.0-alpha1

FragmentController

public class FragmentController
extends Object

java.lang.Object
   ↳ android.support.v4.app.FragmentController


Provides integration points with a FragmentManager for a fragment host.

It is the responsibility of the host to take care of the Fragment's lifecycle. The methods provided by FragmentController are for that purpose.

Summary

Public methods

void attachHost(Fragment parent)

Attaches the host to the FragmentManager for this controller.

static FragmentController createController(FragmentHostCallback<?> callbacks)

Returns a FragmentController.

void dispatchActivityCreated()

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

void dispatchConfigurationChanged(Configuration newConfig)

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

boolean dispatchContextItemSelected(MenuItem item)

Sends a context item selection event to the Fragments managed by the controller's FragmentManager.

void dispatchCreate()

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

boolean dispatchCreateOptionsMenu(Menu menu, MenuInflater inflater)

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

void dispatchDestroy()

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

void dispatchDestroyView()

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

void dispatchLowMemory()

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

void dispatchMultiWindowModeChanged(boolean isInMultiWindowMode)

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

boolean dispatchOptionsItemSelected(MenuItem item)

Sends an option item selection event to the Fragments managed by the controller's FragmentManager.

void dispatchOptionsMenuClosed(Menu menu)

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

void dispatchPause()

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

void dispatchPictureInPictureModeChanged(boolean isInPictureInPictureMode)

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

boolean dispatchPrepareOptionsMenu(Menu menu)

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

void dispatchReallyStop()
void dispatchResume()

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

void dispatchStart()

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

void dispatchStop()

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

void doLoaderDestroy()

This method was deprecated in API level 27.1.0. Loaders are managed separately from FragmentController

void doLoaderRetain()

This method was deprecated in API level 27.1.0. Loaders are managed separately from FragmentController

void doLoaderStart()

This method was deprecated in API level 27.1.0. Loaders are managed separately from FragmentController

void doLoaderStop(boolean retain)

This method was deprecated in API level 27.1.0. Loaders are managed separately from FragmentController

void dumpLoaders(String prefix, FileDescriptor fd, PrintWriter writer, String[] args)

This method was deprecated in API level 27.1.0. Loaders are managed separately from FragmentController

boolean execPendingActions()

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

Fragment findFragmentByWho(String who)

Returns a fragment with the given identifier.

List<Fragment> getActiveFragments(List<Fragment> actives)

Returns the list of active fragments.

int getActiveFragmentsCount()

Returns the number of active fragments.

FragmentManager getSupportFragmentManager()

Returns a FragmentManager for this controller.

LoaderManager getSupportLoaderManager()

This method was deprecated in API level 27.1.0. Loaders are managed separately from FragmentController

void noteStateNotSaved()

Marks the fragment state as unsaved.

View onCreateView(View parent, String name, Context context, AttributeSet attrs)

Instantiates a Fragment's view.

void reportLoaderStart()

This method was deprecated in API level 27.1.0. Loaders are managed separately from FragmentController

void restoreAllState(Parcelable state, List<Fragment> nonConfigList)

This method was deprecated in API level 24.1.0. use restoreAllState(Parcelable, FragmentManagerNonConfig)

void restoreAllState(Parcelable state, FragmentManagerNonConfig nonConfig)

Restores the saved state for all Fragments.

void restoreLoaderNonConfig(SimpleArrayMap<String, LoaderManager> loaderManagers)

This method was deprecated in API level 27.1.0. Loaders are managed separately from FragmentController

SimpleArrayMap<String, LoaderManager> retainLoaderNonConfig()

This method was deprecated in API level 27.1.0. Loaders are managed separately from FragmentController

FragmentManagerNonConfig retainNestedNonConfig()

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

List<Fragment> retainNonConfig()

This method was deprecated in API level 24.1.0. use retainNestedNonConfig() to also track retained nested child fragments

Parcelable saveAllState()

Saves the state for all Fragments.

Inherited methods

From class java.lang.Object

Public methods

attachHost

added in version 24.1.0
void attachHost (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.

Parameters
parent Fragment

createController

added in version 24.1.0
FragmentController createController (FragmentHostCallback<?> callbacks)

Returns a FragmentController.

Parameters
callbacks FragmentHostCallback

Returns
FragmentController

dispatchActivityCreated

added in version 24.1.0
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.

dispatchConfigurationChanged

added in version 24.1.0
void dispatchConfigurationChanged (Configuration newConfig)

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

Call when there is a configuration change.

Parameters
newConfig Configuration

dispatchContextItemSelected

added in version 24.1.0
boolean dispatchContextItemSelected (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

Parameters
item MenuItem

Returns
boolean true if the context menu selection event was consumed

dispatchCreate

added in version 24.1.0
void dispatchCreate ()

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

Call when Fragments should be created.

See also:

dispatchCreateOptionsMenu

added in version 24.1.0
boolean dispatchCreateOptionsMenu (Menu menu, 
                MenuInflater inflater)

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.

Parameters
menu Menu

inflater MenuInflater

Returns
boolean true if the options menu contains items to display

dispatchDestroy

added in version 24.1.0
void dispatchDestroy ()

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

Call when Fragments should be destroyed.

See also:

dispatchDestroyView

added in version 24.1.0
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:

dispatchLowMemory

added in version 24.1.0
void dispatchLowMemory ()

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:

dispatchMultiWindowModeChanged

added in version 24.1.0
void dispatchMultiWindowModeChanged (boolean isInMultiWindowMode)

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.

Parameters
isInMultiWindowMode boolean

dispatchOptionsItemSelected

added in version 24.1.0
boolean dispatchOptionsItemSelected (MenuItem item)

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

Parameters
item MenuItem

Returns
boolean true if the options menu selection event was consumed