# PreferenceFragmentCompat.OnPreferenceStartFragmentCallback

# PreferenceFragmentCompat.OnPreferenceStartFragmentCallback

Artifact:[androidx.preference:preference](https://developer.android.com/jetpack/androidx/releases/preference)  
[View Source](https://cs.android.com/search?q=file:androidx/preference/PreferenceFragmentCompat.java+class:androidx.preference.PreferenceFragmentCompat.OnPreferenceStartFragmentCallback)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/preference#1.0.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/preference/PreferenceFragmentCompat.OnPreferenceStartFragmentCallback "View this page in Java")

<br />

```
interface PreferenceFragmentCompat.OnPreferenceStartFragmentCallback
```

<br />

Known direct subclasses  
[LeanbackSettingsFragmentCompat](https://developer.android.com/reference/kotlin/androidx/leanback/preference/LeanbackSettingsFragmentCompat),[PreferenceHeaderFragmentCompat](https://developer.android.com/reference/kotlin/androidx/preference/PreferenceHeaderFragmentCompat)  

|----------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [LeanbackSettingsFragmentCompat](https://developer.android.com/reference/kotlin/androidx/leanback/preference/LeanbackSettingsFragmentCompat) | This fragment provides a container for displaying a[LeanbackPreferenceFragmentCompat](https://developer.android.com/reference/kotlin/androidx/leanback/preference/LeanbackPreferenceFragmentCompat) |
| [PreferenceHeaderFragmentCompat](https://developer.android.com/reference/kotlin/androidx/preference/PreferenceHeaderFragmentCompat)          | [PreferenceHeaderFragmentCompat](https://developer.android.com/reference/kotlin/androidx/preference/PreferenceHeaderFragmentCompat)implements a two-pane fragment for preferences.                  |

*** ** * ** ***

Interface that the fragment's containing activity should implement to be able to process preference items that wish to switch to a specified fragment.

## Summary

|                                ### Public functions                                 |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [onPreferenceStartFragment](https://developer.android.com/reference/kotlin/androidx/preference/PreferenceFragmentCompat.OnPreferenceStartFragmentCallback#onPreferenceStartFragment(androidx.preference.PreferenceFragmentCompat,androidx.preference.Preference))`(` ` caller: `[PreferenceFragmentCompat](https://developer.android.com/reference/kotlin/androidx/preference/PreferenceFragmentCompat)`,` ` pref: `[Preference](https://developer.android.com/reference/kotlin/androidx/preference/Preference) `)` Called when the user has clicked on a preference that has a fragment class name associated with it. |

## Public functions

### onPreferenceStartFragment

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

```
fun onPreferenceStartFragment(
    caller: PreferenceFragmentCompat,
    pref: Preference
): Boolean
```

Called when the user has clicked on a preference that has a fragment class name associated with it. The implementation should instantiate and switch to an instance of the given fragment.  

|                                                            Parameters                                                             |
|-----------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|
| `caller: `[PreferenceFragmentCompat](https://developer.android.com/reference/kotlin/androidx/preference/PreferenceFragmentCompat) | The fragment requesting navigation     |
| `pref: `[Preference](https://developer.android.com/reference/kotlin/androidx/preference/Preference)                               | The preference requesting the fragment |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | `true`if the fragment creation has been handled |