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

*** ** * ** ***


```
public interface PreferenceFragmentCompat.OnPreferenceStartFragmentCallback
```

<br />

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

|---|---|
| `https://developer.android.com/reference/androidx/leanback/preference/LeanbackSettingsFragmentCompat` | This fragment provides a container for displaying a `https://developer.android.com/reference/androidx/leanback/preference/LeanbackPreferenceFragmentCompat` |
| `https://developer.android.com/reference/androidx/preference/PreferenceHeaderFragmentCompat` | `https://developer.android.com/reference/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 methods |
|---|---|
| `abstract boolean` | `https://developer.android.com/reference/androidx/preference/PreferenceFragmentCompat.OnPreferenceStartFragmentCallback#onPreferenceStartFragment(androidx.preference.PreferenceFragmentCompat,androidx.preference.Preference)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/PreferenceFragmentCompat caller, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/Preference pref )` Called when the user has clicked on a preference that has a fragment class name associated with it. |

## Public methods

### onPreferenceStartFragment

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

```
abstract boolean onPreferenceStartFragment(
    @NonNull PreferenceFragmentCompat caller,
    @NonNull Preference pref
)
```

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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/PreferenceFragmentCompat caller` | The fragment requesting navigation |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/preference/Preference pref` | The preference requesting the fragment |

| Returns |
|---|---|
| `boolean` | `true` if the fragment creation has been handled |