public abstract class

FragmentManager.FragmentLifecycleCallbacks

extends java.lang.Object

 java.lang.Object

↳androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks

Overview

Callback interface for listening to fragment state changes that happen within a given FragmentManager.

Summary

Constructors
publicFragmentLifecycleCallbacks()

Methods
public voidonFragmentActivityCreated(FragmentManager fm, Fragment f, Bundle savedInstanceState)

Called after the fragment has returned from the FragmentManager's call to Fragment.onActivityCreated(Bundle).

public voidonFragmentAttached(FragmentManager fm, Fragment f, Context context)

Called after the fragment has been attached to its host.

public voidonFragmentCreated(FragmentManager fm, Fragment f, Bundle savedInstanceState)

Called after the fragment has returned from the FragmentManager's call to Fragment.onCreate(Bundle).

public voidonFragmentDestroyed(FragmentManager fm, Fragment f)

Called after the fragment has returned from the FragmentManager's call to Fragment.onDestroy().

public voidonFragmentDetached(FragmentManager fm, Fragment f)

Called after the fragment has returned from the FragmentManager's call to Fragment.onDetach().

public voidonFragmentPaused(FragmentManager fm, Fragment f)

Called after the fragment has returned from the FragmentManager's call to Fragment.onPause().

public voidonFragmentPreAttached(FragmentManager fm, Fragment f, Context context)

Called right before the fragment's Fragment.onAttach(Context) method is called.

public voidonFragmentPreCreated(FragmentManager fm, Fragment f, Bundle savedInstanceState)

Called right before the fragment's Fragment.onCreate(Bundle) method is called.

public voidonFragmentResumed(FragmentManager fm, Fragment f)

Called after the fragment has returned from the FragmentManager's call to Fragment.onResume().

public voidonFragmentSaveInstanceState(FragmentManager fm, Fragment f, Bundle outState)

Called after the fragment has returned from the FragmentManager's call to Fragment.onSaveInstanceState(Bundle).

public voidonFragmentStarted(FragmentManager fm, Fragment f)

Called after the fragment has returned from the FragmentManager's call to Fragment.onStart().

public voidonFragmentStopped(FragmentManager fm, Fragment f)

Called after the fragment has returned from the FragmentManager's call to Fragment.onStop().

public voidonFragmentViewCreated(FragmentManager fm, Fragment f, View v, Bundle savedInstanceState)

Called after the fragment has returned a non-null view from the FragmentManager's request to Fragment.onCreateView(LayoutInflater, ViewGroup, Bundle).

public voidonFragmentViewDestroyed(FragmentManager fm, Fragment f)

Called after the fragment has returned from the FragmentManager's call to Fragment.onDestroyView().

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public FragmentLifecycleCallbacks()

Methods

public void onFragmentPreAttached(FragmentManager fm, Fragment f, Context context)

Called right before the fragment's Fragment.onAttach(Context) method is called. This is a good time to inject any required dependencies or perform other configuration for the fragment before any of the fragment's lifecycle methods are invoked.

Parameters:

fm: Host FragmentManager
f: Fragment changing state
context: Context that the Fragment is being attached to

public void onFragmentAttached(FragmentManager fm, Fragment f, Context context)

Called after the fragment has been attached to its host. Its host will have had onAttachFragment called before this call happens.

Parameters:

fm: Host FragmentManager
f: Fragment changing state
context: Context that the Fragment was attached to

public void onFragmentPreCreated(FragmentManager fm, Fragment f, Bundle savedInstanceState)

Called right before the fragment's Fragment.onCreate(Bundle) method is called. This is a good time to inject any required dependencies or perform other configuration for the fragment.

Parameters:

fm: Host FragmentManager
f: Fragment changing state
savedInstanceState: Saved instance bundle from a previous instance

public void onFragmentCreated(FragmentManager fm, Fragment f, Bundle savedInstanceState)

Called after the fragment has returned from the FragmentManager's call to Fragment.onCreate(Bundle). This will only happen once for any given fragment instance, though the fragment may be attached and detached multiple times.

Parameters:

fm: Host FragmentManager
f: Fragment changing state
savedInstanceState: Saved instance bundle from a previous instance

public void onFragmentActivityCreated(FragmentManager fm, Fragment f, Bundle savedInstanceState)

Deprecated: To get a callback specifically when a Fragment activity's is called, register a LifecycleObserver on the Activity's Lifecycle in FragmentManager.FragmentLifecycleCallbacks.onFragmentAttached(FragmentManager, Fragment, Context), removing it when it receives the callback.

Called after the fragment has returned from the FragmentManager's call to Fragment.onActivityCreated(Bundle). This will only happen once for any given fragment instance, though the fragment may be attached and detached multiple times.

Parameters:

fm: Host FragmentManager
f: Fragment changing state
savedInstanceState: Saved instance bundle from a previous instance

public void onFragmentViewCreated(FragmentManager fm, Fragment f, View v, Bundle savedInstanceState)

Called after the fragment has returned a non-null view from the FragmentManager's request to Fragment.onCreateView(LayoutInflater, ViewGroup, Bundle).

Parameters:

fm: Host FragmentManager
f: Fragment that created and owns the view
v: View returned by the fragment
savedInstanceState: Saved instance bundle from a previous instance

public void onFragmentStarted(FragmentManager fm, Fragment f)

Called after the fragment has returned from the FragmentManager's call to Fragment.onStart().

Parameters:

fm: Host FragmentManager
f: Fragment changing state

public void onFragmentResumed(FragmentManager fm, Fragment f)

Called after the fragment has returned from the FragmentManager's call to Fragment.onResume().

Parameters:

fm: Host FragmentManager
f: Fragment changing state

public void onFragmentPaused(FragmentManager fm, Fragment f)

Called after the fragment has returned from the FragmentManager's call to Fragment.onPause().

Parameters:

fm: Host FragmentManager
f: Fragment changing state

public void onFragmentStopped(FragmentManager fm, Fragment f)

Called after the fragment has returned from the FragmentManager's call to Fragment.onStop().

Parameters:

fm: Host FragmentManager
f: Fragment changing state

public void onFragmentSaveInstanceState(FragmentManager fm, Fragment f, Bundle outState)

Called after the fragment has returned from the FragmentManager's call to Fragment.onSaveInstanceState(Bundle).

Parameters:

fm: Host FragmentManager
f: Fragment changing state
outState: Saved state bundle for the fragment

public void onFragmentViewDestroyed(FragmentManager fm, Fragment f)

Called after the fragment has returned from the FragmentManager's call to Fragment.onDestroyView().

Parameters:

fm: Host FragmentManager
f: Fragment changing state

public void onFragmentDestroyed(FragmentManager fm, Fragment f)

Called after the fragment has returned from the FragmentManager's call to Fragment.onDestroy().

Parameters:

fm: Host FragmentManager
f: Fragment changing state

public void onFragmentDetached(FragmentManager fm, Fragment f)

Called after the fragment has returned from the FragmentManager's call to Fragment.onDetach().

Parameters:

fm: Host FragmentManager
f: Fragment changing state