# FragmentManager.FragmentLifecycleCallbacks

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Ctors](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#pubctors)\|[Methods](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#inhmethods)  

# FragmentManager.FragmentLifecycleCallbacks

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/app/FragmentManager.FragmentLifecycleCallbacks "View this page in Kotlin")\|Java

`
public
static

abstract
class
FragmentManager.FragmentLifecycleCallbacks
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|--------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.FragmentManager.FragmentLifecycleCallbacks |

<br />

*** ** * ** ***

<br />

**This class was deprecated in API level 28.**   
Use the[Support Library](https://developer.android.com/tools/extras/support-library)[FragmentManager.FragmentLifecycleCallbacks](https://developer.android.com/reference/androidx/fragment/app/FragmentManager.FragmentLifecycleCallbacks.html)

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

## Summary

|                                                                       ### Public constructors                                                                        ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[FragmentLifecycleCallbacks](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#FragmentLifecycleCallbacks())`() ` |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                   ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                   ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void` | ` `[onFragmentActivityCreated](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#onFragmentActivityCreated(android.app.FragmentManager,%20android.app.Fragment,%20android.os.Bundle))`(`[FragmentManager](https://developer.android.com/reference/android/app/FragmentManager)` fm, `[Fragment](https://developer.android.com/reference/android/app/Fragment)` f, `[Bundle](https://developer.android.com/reference/android/os/Bundle)` savedInstanceState) ` Called after the fragment has returned from the FragmentManager's call to[Fragment.onActivityCreated(Bundle)](https://developer.android.com/reference/android/app/Fragment#onActivityCreated(android.os.Bundle)).                                                                                                                                                                                  |
| ` void` | ` `[onFragmentAttached](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#onFragmentAttached(android.app.FragmentManager,%20android.app.Fragment,%20android.content.Context))`(`[FragmentManager](https://developer.android.com/reference/android/app/FragmentManager)` fm, `[Fragment](https://developer.android.com/reference/android/app/Fragment)` f, `[Context](https://developer.android.com/reference/android/content/Context)` context) ` Called after the fragment has been attached to its host.                                                                                                                                                                                                                                                                                                                                                       |
| ` void` | ` `[onFragmentCreated](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#onFragmentCreated(android.app.FragmentManager,%20android.app.Fragment,%20android.os.Bundle))`(`[FragmentManager](https://developer.android.com/reference/android/app/FragmentManager)` fm, `[Fragment](https://developer.android.com/reference/android/app/Fragment)` f, `[Bundle](https://developer.android.com/reference/android/os/Bundle)` savedInstanceState) ` Called after the fragment has returned from the FragmentManager's call to[Fragment.onCreate(Bundle)](https://developer.android.com/reference/android/app/Fragment#onCreate(android.os.Bundle)).                                                                                                                                                                                                                    |
| ` void` | ` `[onFragmentDestroyed](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#onFragmentDestroyed(android.app.FragmentManager,%20android.app.Fragment))`(`[FragmentManager](https://developer.android.com/reference/android/app/FragmentManager)` fm, `[Fragment](https://developer.android.com/reference/android/app/Fragment)` f) ` Called after the fragment has returned from the FragmentManager's call to[Fragment.onDestroy()](https://developer.android.com/reference/android/app/Fragment#onDestroy()).                                                                                                                                                                                                                                                                                                                                                    |
| ` void` | ` `[onFragmentDetached](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#onFragmentDetached(android.app.FragmentManager,%20android.app.Fragment))`(`[FragmentManager](https://developer.android.com/reference/android/app/FragmentManager)` fm, `[Fragment](https://developer.android.com/reference/android/app/Fragment)` f) ` Called after the fragment has returned from the FragmentManager's call to[Fragment.onDetach()](https://developer.android.com/reference/android/app/Fragment#onDetach()).                                                                                                                                                                                                                                                                                                                                                        |
| ` void` | ` `[onFragmentPaused](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#onFragmentPaused(android.app.FragmentManager,%20android.app.Fragment))`(`[FragmentManager](https://developer.android.com/reference/android/app/FragmentManager)` fm, `[Fragment](https://developer.android.com/reference/android/app/Fragment)` f) ` Called after the fragment has returned from the FragmentManager's call to[Fragment.onPause()](https://developer.android.com/reference/android/app/Fragment#onPause()).                                                                                                                                                                                                                                                                                                                                                              |
| ` void` | ` `[onFragmentPreAttached](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#onFragmentPreAttached(android.app.FragmentManager,%20android.app.Fragment,%20android.content.Context))`(`[FragmentManager](https://developer.android.com/reference/android/app/FragmentManager)` fm, `[Fragment](https://developer.android.com/reference/android/app/Fragment)` f, `[Context](https://developer.android.com/reference/android/content/Context)` context) ` Called right before the fragment's[Fragment.onAttach(Context)](https://developer.android.com/reference/android/app/Fragment#onAttach(android.content.Context))method is called.                                                                                                                                                                                                                          |
| ` void` | ` `[onFragmentPreCreated](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#onFragmentPreCreated(android.app.FragmentManager,%20android.app.Fragment,%20android.os.Bundle))`(`[FragmentManager](https://developer.android.com/reference/android/app/FragmentManager)` fm, `[Fragment](https://developer.android.com/reference/android/app/Fragment)` f, `[Bundle](https://developer.android.com/reference/android/os/Bundle)` savedInstanceState) ` Called right before the fragment's[Fragment.onCreate(Bundle)](https://developer.android.com/reference/android/app/Fragment#onCreate(android.os.Bundle))method is called.                                                                                                                                                                                                                                     |
| ` void` | ` `[onFragmentResumed](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#onFragmentResumed(android.app.FragmentManager,%20android.app.Fragment))`(`[FragmentManager](https://developer.android.com/reference/android/app/FragmentManager)` fm, `[Fragment](https://developer.android.com/reference/android/app/Fragment)` f) ` Called after the fragment has returned from the FragmentManager's call to[Fragment.onResume()](https://developer.android.com/reference/android/app/Fragment#onResume()).                                                                                                                                                                                                                                                                                                                                                          |
| ` void` | ` `[onFragmentSaveInstanceState](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#onFragmentSaveInstanceState(android.app.FragmentManager,%20android.app.Fragment,%20android.os.Bundle))`(`[FragmentManager](https://developer.android.com/reference/android/app/FragmentManager)` fm, `[Fragment](https://developer.android.com/reference/android/app/Fragment)` f, `[Bundle](https://developer.android.com/reference/android/os/Bundle)` outState) ` Called after the fragment has returned from the FragmentManager's call to[Fragment.onSaveInstanceState(Bundle)](https://developer.android.com/reference/android/app/Fragment#onSaveInstanceState(android.os.Bundle)).                                                                                                                                                                                    |
| ` void` | ` `[onFragmentStarted](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#onFragmentStarted(android.app.FragmentManager,%20android.app.Fragment))`(`[FragmentManager](https://developer.android.com/reference/android/app/FragmentManager)` fm, `[Fragment](https://developer.android.com/reference/android/app/Fragment)` f) ` Called after the fragment has returned from the FragmentManager's call to[Fragment.onStart()](https://developer.android.com/reference/android/app/Fragment#onStart()).                                                                                                                                                                                                                                                                                                                                                            |
| ` void` | ` `[onFragmentStopped](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#onFragmentStopped(android.app.FragmentManager,%20android.app.Fragment))`(`[FragmentManager](https://developer.android.com/reference/android/app/FragmentManager)` fm, `[Fragment](https://developer.android.com/reference/android/app/Fragment)` f) ` Called after the fragment has returned from the FragmentManager's call to[Fragment.onStop()](https://developer.android.com/reference/android/app/Fragment#onStop()).                                                                                                                                                                                                                                                                                                                                                              |
| ` void` | ` `[onFragmentViewCreated](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#onFragmentViewCreated(android.app.FragmentManager,%20android.app.Fragment,%20android.view.View,%20android.os.Bundle))`(`[FragmentManager](https://developer.android.com/reference/android/app/FragmentManager)` fm, `[Fragment](https://developer.android.com/reference/android/app/Fragment)` f, `[View](https://developer.android.com/reference/android/view/View)` v, `[Bundle](https://developer.android.com/reference/android/os/Bundle)` savedInstanceState) ` Called after the fragment has returned a non-null view from the FragmentManager's request to[Fragment.onCreateView(LayoutInflater, ViewGroup, Bundle)](https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)). |
| ` void` | ` `[onFragmentViewDestroyed](https://developer.android.com/reference/android/app/FragmentManager.FragmentLifecycleCallbacks#onFragmentViewDestroyed(android.app.FragmentManager,%20android.app.Fragment))`(`[FragmentManager](https://developer.android.com/reference/android/app/FragmentManager)` fm, `[Fragment](https://developer.android.com/reference/android/app/Fragment)` f) ` Called after the fragment has returned from the FragmentManager's call to[Fragment.onDestroyView()](https://developer.android.com/reference/android/app/Fragment#onDestroyView()).                                                                                                                                                                                                                                                                                                                                    |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(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](https://developer.android.com/reference/java/lang/Object#wait(long))`(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](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### FragmentLifecycleCallbacks

```
public FragmentLifecycleCallbacks ()
```

<br />

<br />

## Public methods

### onFragmentActivityCreated

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

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

Called after the fragment has returned from the FragmentManager's call to[Fragment.onActivityCreated(Bundle)](https://developer.android.com/reference/android/app/Fragment#onActivityCreated(android.os.Bundle)). This will only happen once for any given fragment instance, though the fragment may be attached and detached multiple times.

<br />

|                                      Parameters                                       ||
|----------------------|-----------------------------------------------------------------|
| `fm`                 | `FragmentManager`: Host FragmentManager <br />                  |
| `f`                  | `Fragment`: Fragment changing state <br />                      |
| `savedInstanceState` | `Bundle`: Saved instance bundle from a previous instance <br /> |

### onFragmentAttached

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

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

<br />

|                               Parameters                               ||
|-----------|-------------------------------------------------------------|
| `fm`      | `FragmentManager`: Host FragmentManager <br />              |
| `f`       | `Fragment`: Fragment changing state <br />                  |
| `context` | `Context`: Context that the Fragment was attached to <br /> |

### onFragmentCreated

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

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

Called after the fragment has returned from the FragmentManager's call to[Fragment.onCreate(Bundle)](https://developer.android.com/reference/android/app/Fragment#onCreate(android.os.Bundle)). This will only happen once for any given fragment instance, though the fragment may be attached and detached multiple times.

<br />

|                                      Parameters                                       ||
|----------------------|-----------------------------------------------------------------|
| `fm`                 | `FragmentManager`: Host FragmentManager <br />                  |
| `f`                  | `Fragment`: Fragment changing state <br />                      |
| `savedInstanceState` | `Bundle`: Saved instance bundle from a previous instance <br /> |

### onFragmentDestroyed

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onFragmentDestroyed (FragmentManager fm, 
                Fragment f)
```

Called after the fragment has returned from the FragmentManager's call to[Fragment.onDestroy()](https://developer.android.com/reference/android/app/Fragment#onDestroy()).

<br />

|                      Parameters                      ||
|------|------------------------------------------------|
| `fm` | `FragmentManager`: Host FragmentManager <br /> |
| `f`  | `Fragment`: Fragment changing state <br />     |

### onFragmentDetached

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onFragmentDetached (FragmentManager fm, 
                Fragment f)
```

Called after the fragment has returned from the FragmentManager's call to[Fragment.onDetach()](https://developer.android.com/reference/android/app/Fragment#onDetach()).

<br />

|                      Parameters                      ||
|------|------------------------------------------------|
| `fm` | `FragmentManager`: Host FragmentManager <br /> |
| `f`  | `Fragment`: Fragment changing state <br />     |

### onFragmentPaused

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onFragmentPaused (FragmentManager fm, 
                Fragment f)
```

Called after the fragment has returned from the FragmentManager's call to[Fragment.onPause()](https://developer.android.com/reference/android/app/Fragment#onPause()).

<br />

|                      Parameters                      ||
|------|------------------------------------------------|
| `fm` | `FragmentManager`: Host FragmentManager <br /> |
| `f`  | `Fragment`: Fragment changing state <br />     |

### onFragmentPreAttached

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

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

Called right before the fragment's[Fragment.onAttach(Context)](https://developer.android.com/reference/android/app/Fragment#onAttach(android.content.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.

<br />

|                                 Parameters                                  ||
|-----------|------------------------------------------------------------------|
| `fm`      | `FragmentManager`: Host FragmentManager <br />                   |
| `f`       | `Fragment`: Fragment changing state <br />                       |
| `context` | `Context`: Context that the Fragment is being attached to <br /> |

### onFragmentPreCreated

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

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

Called right before the fragment's[Fragment.onCreate(Bundle)](https://developer.android.com/reference/android/app/Fragment#onCreate(android.os.Bundle))method is called. This is a good time to inject any required dependencies or perform other configuration for the fragment.

<br />

|                                      Parameters                                       ||
|----------------------|-----------------------------------------------------------------|
| `fm`                 | `FragmentManager`: Host FragmentManager <br />                  |
| `f`                  | `Fragment`: Fragment changing state <br />                      |
| `savedInstanceState` | `Bundle`: Saved instance bundle from a previous instance <br /> |

### onFragmentResumed

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onFragmentResumed (FragmentManager fm, 
                Fragment f)
```

Called after the fragment has returned from the FragmentManager's call to[Fragment.onResume()](https://developer.android.com/reference/android/app/Fragment#onResume()).

<br />

|                      Parameters                      ||
|------|------------------------------------------------|
| `fm` | `FragmentManager`: Host FragmentManager <br /> |
| `f`  | `Fragment`: Fragment changing state <br />     |

### onFragmentSaveInstanceState

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

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

Called after the fragment has returned from the FragmentManager's call to[Fragment.onSaveInstanceState(Bundle)](https://developer.android.com/reference/android/app/Fragment#onSaveInstanceState(android.os.Bundle)).

<br />

|                            Parameters                            ||
|------------|------------------------------------------------------|
| `fm`       | `FragmentManager`: Host FragmentManager <br />       |
| `f`        | `Fragment`: Fragment changing state <br />           |
| `outState` | `Bundle`: Saved state bundle for the fragment <br /> |

### onFragmentStarted

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onFragmentStarted (FragmentManager fm, 
                Fragment f)
```

Called after the fragment has returned from the FragmentManager's call to[Fragment.onStart()](https://developer.android.com/reference/android/app/Fragment#onStart()).

<br />

|                      Parameters                      ||
|------|------------------------------------------------|
| `fm` | `FragmentManager`: Host FragmentManager <br /> |
| `f`  | `Fragment`: Fragment changing state <br />     |

### onFragmentStopped

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onFragmentStopped (FragmentManager fm, 
                Fragment f)
```

Called after the fragment has returned from the FragmentManager's call to[Fragment.onStop()](https://developer.android.com/reference/android/app/Fragment#onStop()).

<br />

|                      Parameters                      ||
|------|------------------------------------------------|
| `fm` | `FragmentManager`: Host FragmentManager <br /> |
| `f`  | `Fragment`: Fragment changing state <br />     |

### onFragmentViewCreated

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
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)](https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)).

<br />

|                                      Parameters                                       ||
|----------------------|-----------------------------------------------------------------|
| `fm`                 | `FragmentManager`: Host FragmentManager <br />                  |
| `f`                  | `Fragment`: Fragment that created and owns the view <br />      |
| `v`                  | `View`: View returned by the fragment <br />                    |
| `savedInstanceState` | `Bundle`: Saved instance bundle from a previous instance <br /> |

### onFragmentViewDestroyed

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onFragmentViewDestroyed (FragmentManager fm, 
                Fragment f)
```

Called after the fragment has returned from the FragmentManager's call to[Fragment.onDestroyView()](https://developer.android.com/reference/android/app/Fragment#onDestroyView()).

<br />

|                      Parameters                      ||
|------|------------------------------------------------|
| `fm` | `FragmentManager`: Host FragmentManager <br /> |
| `f`  | `Fragment`: Fragment changing state <br />     |