FragmentManager.FragmentLifecycleCallbacks  |  API reference  |  Android Developers


public static abstract class FragmentManager.FragmentLifecycleCallbacks
extends Object



This class was deprecated in API level 28.
Use the Support Library FragmentManager.FragmentLifecycleCallbacks

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

Summary

Public constructors

FragmentLifecycleCallbacks()

Public methods

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

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

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

Called after the fragment has been attached to its host.

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

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

void onFragmentDestroyed(FragmentManager fm, Fragment f)

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

void onFragmentDetached(FragmentManager fm, Fragment f)

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

void onFragmentPaused(FragmentManager fm, Fragment f)

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

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

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

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

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

void onFragmentResumed(FragmentManager fm, Fragment f)

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

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

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

void onFragmentStarted(FragmentManager fm, Fragment f)

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

void onFragmentStopped(FragmentManager fm, Fragment f)

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

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

void onFragmentViewDestroyed(FragmentManager fm, Fragment f)

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

Inherited methods

From class java.lang.Object

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public constructors

FragmentLifecycleCallbacks

public FragmentLifecycleCallbacks ()

Public methods

onFragmentActivityCreated

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

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 FragmentManager: Host FragmentManager
f Fragment: Fragment changing state
savedInstanceState Bundle: Saved instance bundle from a previous instance

onFragmentAttached

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 FragmentManager: Host FragmentManager
f Fragment: Fragment changing state
context Context: Context that the Fragment was attached to

onFragmentCreated

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 FragmentManager: Host FragmentManager
f Fragment: Fragment changing state
savedInstanceState Bundle: Saved instance bundle from a previous instance

onFragmentDestroyed

public void onFragmentDestroyed (FragmentManager fm, 
                Fragment f)

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

Parameters
fm FragmentManager: Host FragmentManager
f Fragment: Fragment changing state

onFragmentDetached

public void onFragmentDetached (FragmentManager fm, 
                Fragment f)

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

Parameters
fm FragmentManager: Host FragmentManager
f Fragment: Fragment changing state

onFragmentPaused

public void onFragmentPaused (FragmentManager fm, 
                Fragment f)

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

Parameters
fm FragmentManager: Host FragmentManager
f Fragment: Fragment changing state

onFragmentPreAttached

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 for the fragment before any of the fragment's lifecycle methods are invoked.

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

onFragmentPreCreated

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 FragmentManager: Host FragmentManager
f Fragment: Fragment changing state
savedInstanceState Bundle: Saved instance bundle from a previous instance

onFragmentResumed

public void onFragmentResumed (FragmentManager fm, 
                Fragment f)

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

Parameters
fm FragmentManager: Host FragmentManager
f Fragment: Fragment changing state

onFragmentSaveInstanceState

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 FragmentManager: Host FragmentManager
f Fragment: Fragment changing state
outState Bundle: Saved state bundle for the fragment

onFragmentStarted

public void onFragmentStarted (FragmentManager fm, 
                Fragment f)

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

Parameters
fm FragmentManager: Host FragmentManager
f Fragment: Fragment changing state

onFragmentStopped

public void onFragmentStopped (FragmentManager fm, 
                Fragment f)

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

Parameters
fm FragmentManager: Host FragmentManager
f Fragment: Fragment changing state

onFragmentViewCreated

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 FragmentManager: Host FragmentManager
f Fragment: Fragment that created and owns the view
v View: View returned by the fragment
savedInstanceState Bundle: Saved instance bundle from a previous instance

onFragmentViewDestroyed

public void onFragmentViewDestroyed (FragmentManager fm, 
                Fragment f)

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

Parameters
fm FragmentManager: Host FragmentManager
f Fragment: Fragment changing state