# PreferenceFragment

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:preference-v7:28.0.0-alpha1  
Summary:[Nested Classes](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#nestedclasses)\|[XML Attrs](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#lattrs)\|[Constants](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#constants)\|[Inherited Constants](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#inhconstants)\|[Ctors](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#pubctors)\|[Methods](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#pubmethods)\|[Protected Methods](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#promethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#)  

# PreferenceFragment

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public


abstract
class
PreferenceFragment
`  
`


``

extends `[Fragment](https://developer.android.com/reference/android/app/Fragment.html)`


``


implements

`[PreferenceManager.OnPreferenceTreeClickListener](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager.OnPreferenceTreeClickListener)`,

`[PreferenceManager.OnDisplayPreferenceDialogListener](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager.OnDisplayPreferenceDialogListener)`,

`[PreferenceManager.OnNavigateToScreenListener](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager.OnNavigateToScreenListener)`,

`[DialogPreference.TargetFragment](https://developer.android.com/reference/android/support/v7/preference/DialogPreference.TargetFragment)`


`

|---|---|---------------------------------------------------|
| java.lang.Object                                        |||
| ↳ | [android.app.Fragment](https://developer.android.com/reference/android/app/Fragment.html) ||
|   | ↳ | android.support.v14.preference.PreferenceFragment |

|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#)Known Direct Subclasses [BaseLeanbackPreferenceFragment](https://developer.android.com/reference/android/support/v17/preference/BaseLeanbackPreferenceFragment) |-----------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------| | [BaseLeanbackPreferenceFragment](https://developer.android.com/reference/android/support/v17/preference/BaseLeanbackPreferenceFragment) | This fragment provides a preference fragment with leanback-style behavior, suitable for embedding into broader UI elements. | |

|---|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#)Known Indirect Subclasses [LeanbackPreferenceFragment](https://developer.android.com/reference/android/support/v17/preference/LeanbackPreferenceFragment) |---------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------| | [LeanbackPreferenceFragment](https://developer.android.com/reference/android/support/v17/preference/LeanbackPreferenceFragment) | This fragment provides a fully decorated leanback-style preference fragment, including a list background and header. | ||

<br />

*** ** * ** ***

Shows a hierarchy of[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)objects as lists. These preferences will automatically save to[SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences.html)as the user interacts with them. To retrieve an instance of[SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences.html)that the preference hierarchy in this fragment will use, call[getDefaultSharedPreferences(android.content.Context)](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager#getDefaultSharedPreferences(android.content.Context))with a context in the same package as this fragment.

Furthermore, the preferences shown will follow the visual style of system preferences. It is easy to create a hierarchy of preferences (that can be shown on multiple screens) via XML. For these reasons, it is recommended to use this fragment (as a superclass) to deal with preferences in applications.

A[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)object should be at the top of the preference hierarchy. Furthermore, subsequent[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)in the hierarchy denote a screen break--that is the preferences contained within subsequent[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)should be shown on another screen. The preference framework handles this by calling[onNavigateToScreen(PreferenceScreen)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onNavigateToScreen(android.support.v7.preference.PreferenceScreen)).

The preference hierarchy can be formed in multiple ways:
- From an XML file specifying the hierarchy
- From different[Activities](https://developer.android.com/reference/android/app/Activity.html)that each specify its own preferences in an XML file via[Activity](https://developer.android.com/reference/android/app/Activity.html)meta-data
- From an object hierarchy rooted with[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)

  To inflate from XML, use the[addPreferencesFromResource(int)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#addPreferencesFromResource(int)). The root element should be a[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen). Subsequent elements can point to actual[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)subclasses. As mentioned above, subsequent[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)in the hierarchy will result in the screen break.

  To specify an object hierarchy rooted with[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen), use[setPreferenceScreen(PreferenceScreen)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#setPreferenceScreen(android.support.v7.preference.PreferenceScreen)).

  As a convenience, this fragment implements a click listener for any preference in the current hierarchy, see[onPreferenceTreeClick(Preference)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onPreferenceTreeClick(android.support.v7.preference.Preference)).  

  ### Developer Guides

  For information about using`PreferenceFragment`, read the[Settings](https://developer.android.com/guide/topics/ui/settings)guide.

  ### Sample Code

  The following sample code shows a simple preference fragment that is populated from a resource. The resource it loads is:  

  ```
  <PreferenceScreen
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:title="@string/root_title">

      <Preference
          android:key="basic_preference"
          android:title="@string/title_basic_preference"
          android:summary="@string/summary_basic_preference" />

      <Preference
          android:key="stylish_preference"
          android:title="@string/title_stylish_preference"
          android:summary="@string/summary_stylish_preference" />

      <Preference
          android:key="preference_with_icon"
          android:title="Preference with icon"
          android:summary="This preference has an icon"
          android:icon="@android:drawable/ic_menu_camera" />

      <PreferenceCategory
          android:title="@string/inline_preferences">

          <CheckBoxPreference
              android:key="checkbox_preference"
              android:title="@string/title_checkbox_preference"
              android:summary="@string/summary_checkbox_preference" />

          <SwitchPreference
              android:key="switch_preference"
              android:title="Switch preference"
              android:summary="This is a switch" />

          <DropDownPreference
              android:key="dropdown_preference"
              android:title="@string/title_dropdown_preference"
              android:summary="@string/summary_dropdown_preference"
              android:entries="@array/entries_list_preference"
              android:entryValues="@array/entryvalues_list_preference" />

      </PreferenceCategory>

      <PreferenceCategory
          android:title="@string/dialog_based_preferences">

          <EditTextPreference
              android:key="edittext_preference"
              android:title="@string/title_edittext_preference"
              android:summary="@string/summary_edittext_preference"
              android:dialogTitle="@string/dialog_title_edittext_preference" />

          <ListPreference
              android:key="list_preference"
              android:title="@string/title_list_preference"
              android:summary="@string/summary_list_preference"
              android:entries="@array/entries_list_preference"
              android:entryValues="@array/entryvalues_list_preference"
              android:dialogTitle="@string/dialog_title_list_preference" />

          <MultiSelectListPreference
              android:key="multi_select_list_preference"
              android:title="@string/title_multi_list_preference"
              android:summary="@string/summary_multi_list_preference"
              android:entries="@array/entries_list_preference"
              android:entryValues="@array/entryvalues_list_preference"
              android:dialogTitle="@string/dialog_title_multi_list_preference" />

      </PreferenceCategory>

      <PreferenceCategory
          android:title="@string/launch_preferences">

          <!-- This PreferenceScreen tag serves as a screen break (similar to page break
               in word processing). Like for other preference types, we assign a key
               here so it is able to save and restore its instance state. -->
          <PreferenceScreen
              android:key="screen_preference"
              android:title="@string/title_screen_preference"
              android:summary="@string/summary_screen_preference">

              <!-- You can place more preferences here that will be shown on the next screen. -->

              <CheckBoxPreference
                  android:key="next_screen_checkbox_preference"
                  android:title="@string/title_next_screen_toggle_preference"
                  android:summary="@string/summary_next_screen_toggle_preference" />

          </PreferenceScreen>

          <PreferenceScreen
              android:title="@string/title_intent_preference"
              android:summary="@string/summary_intent_preference">

              <intent android:action="android.intent.action.VIEW"
                  android:data="http://www.android.com" />

          </PreferenceScreen>

      </PreferenceCategory>

      <PreferenceCategory
          android:title="@string/preference_attributes">

          <CheckBoxPreference
              android:key="parent_checkbox_preference"
              android:title="@string/title_parent_preference"
              android:summary="@string/summary_parent_preference" />

          <!-- The visual style of a child is defined by this styled theme attribute. -->
          <CheckBoxPreference
              android:key="child_checkbox_preference"
              android:dependency="parent_checkbox_preference"
              android:layout="?android:attr/preferenceLayoutChild"
              android:title="@string/title_child_preference"
              android:summary="@string/summary_child_preference" />

      </PreferenceCategory>

  </PreferenceScreen>
  ```

  The fragment implementation itself simply populates the preferences when created. Note that the preferences framework takes care of loading the current values out of the app preferences and writing them when changed:  

  ```
  public static class PrefsFragment extends PreferenceFragment {

      @Override
      public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
          // Load the preferences from an XML resource
          setPreferencesFromResource(R.xml.preferences, rootKey);
      }
  }
  ```

  <br />

  **See also:**
  - [Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)
  - [PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)

  ## Summary

  |                                                                                                                                                                        ### Nested classes                                                                                                                                                                         ||
  |--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  | ` interface` | [PreferenceFragment.OnPreferenceDisplayDialogCallback](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment.OnPreferenceDisplayDialogCallback) <br />                                                                                                                                                          |
  | ` interface` | [PreferenceFragment.OnPreferenceStartFragmentCallback](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment.OnPreferenceStartFragmentCallback) Interface that PreferenceFragment's containing activity should implement to be able to process preference items that wish to switch to a specified fragment.    |
  | ` interface` | [PreferenceFragment.OnPreferenceStartScreenCallback](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment.OnPreferenceStartScreenCallback) Interface that PreferenceFragment's containing activity should implement to be able to process preference items that wish to switch to a new screen of preferences. |

  |                                                                                    ### XML attributes                                                                                    ||
  |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
  | [`PreferenceFragment_android_divider`](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#attr_PreferenceFragment_android_divider)             |   |
  | [`PreferenceFragment_android_dividerHeight`](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#attr_PreferenceFragment_android_dividerHeight) |   |

  |                                                                                                                                                         ### Constants                                                                                                                                                         ||
  |----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  | `String` | [ARG_PREFERENCE_ROOT](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#ARG_PREFERENCE_ROOT) Fragment argument used to specify the tag of the desired root[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)object. |

  |                                                                                                                                                                                                                                                                                                                ### Inherited constants                                                                                                                                                                                                                                                                                                                |
  |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  | [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#)From interface` android.content.ComponentCallbacks2 ` |-------|---------------------------------------| | `int` | `TRIM_MEMORY_BACKGROUND` <br />       | | `int` | `TRIM_MEMORY_COMPLETE` <br />         | | `int` | `TRIM_MEMORY_MODERATE` <br />         | | `int` | `TRIM_MEMORY_RUNNING_CRITICAL` <br /> | | `int` | `TRIM_MEMORY_RUNNING_LOW` <br />      | | `int` | `TRIM_MEMORY_RUNNING_MODERATE` <br /> | | `int` | `TRIM_MEMORY_UI_HIDDEN` <br />        | |

  |                                                             ### Public constructors                                                             ||
  |----------------------------------------------------------------------------------------------------------------------------------------------|---|
  | ` `[PreferenceFragment](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#PreferenceFragment())`() ` |

  |                                                                                                                                                                                                                                                                                                                                                                                         ### Public methods                                                                                                                                                                                                                                                                                                                                                                                          ||
  |-------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  | ` void`                                                                                                                       | ` `[addPreferencesFromResource](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#addPreferencesFromResource(int))`(int preferencesResId) ` Inflates the given XML resource and adds the preference hierarchy to the current preference hierarchy.                                                                                                                                                                                                                                                                                                                                                                           |
  | ` `[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)                             | ` `[findPreference](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#findPreference(java.lang.CharSequence))`(CharSequence key) ` Finds a[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)based on its key.                                                                                                                                                                                                                                                                                                                                                                    |
  | ` final `[RecyclerView](https://developer.android.com/reference/android/support/v7/widget/RecyclerView)                       | ` `[getListView](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#getListView())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
  | ` `[PreferenceManager](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager)               | ` `[getPreferenceManager](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#getPreferenceManager())`() ` Returns the[PreferenceManager](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager)used by this fragment.                                                                                                                                                                                                                                                                                                                                                                       |
  | ` `[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)                 | ` `[getPreferenceScreen](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#getPreferenceScreen())`() ` Gets the root of the preference hierarchy that this fragment is showing.                                                                                                                                                                                                                                                                                                                                                                                                                                              |
  | ` void`                                                                                                                       | ` `[onActivityCreated](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onActivityCreated(android.os.Bundle))`(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` savedInstanceState) `                                                                                                                                                                                                                                                                                                                                                                                                             |
  | ` void`                                                                                                                       | ` `[onCreate](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onCreate(android.os.Bundle))`(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` savedInstanceState) `                                                                                                                                                                                                                                                                                                                                                                                                                               |
  | ` `[RecyclerView.LayoutManager](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutManager) | ` `[onCreateLayoutManager](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onCreateLayoutManager())`() ` Called from[onCreateRecyclerView(LayoutInflater, ViewGroup, Bundle)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onCreateRecyclerView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle))to create the[RecyclerView.LayoutManager](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutManager)for the created[RecyclerView](https://developer.android.com/reference/android/support/v7/widget/RecyclerView). |
  | ` abstract void`                                                                                                              | ` `[onCreatePreferences](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onCreatePreferences(android.os.Bundle, java.lang.String))`(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` savedInstanceState, String rootKey) ` Called during[onCreate(Bundle)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onCreate(android.os.Bundle))to supply the preferences for this fragment.                                                                                                                                                                    |
  | ` `[RecyclerView](https://developer.android.com/reference/android/support/v7/widget/RecyclerView)                             | ` `[onCreateRecyclerView](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onCreateRecyclerView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle))`(`[LayoutInflater](https://developer.android.com/reference/android/view/LayoutInflater.html)` inflater, `[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)` parent, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` savedInstanceState) ` Creates the[RecyclerView](https://developer.android.com/reference/android/support/v7/widget/RecyclerView)used to display the preferences.      |
  | ` `[View](https://developer.android.com/reference/android/view/View.html)                                                     | ` `[onCreateView](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle))`(`[LayoutInflater](https://developer.android.com/reference/android/view/LayoutInflater.html)` inflater, `[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)` container, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` savedInstanceState) `                                                                                                                                                             |
  | ` void`                                                                                                                       | ` `[onDestroyView](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onDestroyView())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
  | ` void`                                                                                                                       | ` `[onDisplayPreferenceDialog](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onDisplayPreferenceDialog(android.support.v7.preference.Preference))`(`[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)` preference) ` Called when a preference in the tree requests to display a dialog.                                                                                                                                                                                                                                                                                     |
  | ` void`                                                                                                                       | ` `[onNavigateToScreen](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onNavigateToScreen(android.support.v7.preference.PreferenceScreen))`(`[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)` preferenceScreen) ` Called by[onClick()](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen#onClick())in order to navigate to a new screen of preferences.                                                                                                                                                                   |
  | ` boolean`                                                                                                                    | ` `[onPreferenceTreeClick](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onPreferenceTreeClick(android.support.v7.preference.Preference))`(`[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)` preference) ` Called when a preference in the tree rooted at this[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)has been clicked.                                                                                                                                                                                 |
  | ` void`                                                                                                                       | ` `[onSaveInstanceState](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onSaveInstanceState(android.os.Bundle))`(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` outState) `                                                                                                                                                                                                                                                                                                                                                                                                                   |
  | ` void`                                                                                                                       | ` `[onStart](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onStart())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
  | ` void`                                                                                                                       | ` `[onStop](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onStop())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
  | ` void`                                                                                                                       | ` `[onViewCreated](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onViewCreated(android.view.View, android.os.Bundle))`(`[View](https://developer.android.com/reference/android/view/View.html)` view, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` savedInstanceState) `                                                                                                                                                                                                                                                                                                                   |
  | ` void`                                                                                                                       | ` `[scrollToPreference](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#scrollToPreference(android.support.v7.preference.Preference))`(`[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)` preference) `                                                                                                                                                                                                                                                                                                                                                                      |
  | ` void`                                                                                                                       | ` `[scrollToPreference](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#scrollToPreference(java.lang.String))`(String key) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
  | ` void`                                                                                                                       | ` `[setDivider](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#setDivider(android.graphics.drawable.Drawable))`(`[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)` divider) ` Sets the drawable that will be drawn between each item in the list.                                                                                                                                                                                                                                                                                                                              |
  | ` void`                                                                                                                       | ` `[setDividerHeight](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#setDividerHeight(int))`(int height) ` Sets the height of the divider that will be drawn between each item in the list.                                                                                                                                                                                                                                                                                                                                                                                                                               |
  | ` void`                                                                                                                       | ` `[setPreferenceScreen](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#setPreferenceScreen(android.support.v7.preference.PreferenceScreen))`(`[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)` preferenceScreen) ` Sets the root of the preference hierarchy that this fragment is showing.                                                                                                                                                                                                                                                                   |
  | ` void`                                                                                                                       | ` `[setPreferencesFromResource](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#setPreferencesFromResource(int, java.lang.String))`(int preferencesResId, String key) ` Inflates the given XML resource and replaces the current preference hierarchy (if any) with the preference hierarchy rooted at`key`.                                                                                                                                                                                                                                                                                                               |

  |                                                                                                                                                                                                               ### Protected methods                                                                                                                                                                                                               ||
  |------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  | ` `[Adapter](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter) | ` `[onCreateAdapter](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onCreateAdapter(android.support.v7.preference.PreferenceScreen))`(`[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)` preferenceScreen) ` Creates the root adapter. |

  | ### Inherited methods |
  |-----------------------|---|
  | [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#)From class` `[android.app.Fragment](https://developer.android.com/reference/android/app/Fragment.html)` ` |------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` void`                                                                                              | ` dump(String arg0, FileDescriptor arg1, PrintWriter arg2, String[] arg3) `                                                                                                                                                                                                                                                                     | | ` final boolean`                                                                                     | ` equals(Object arg0) `                                                                                                                                                                                                                                                                                                                         | | ` final `[Activity](https://developer.android.com/reference/android/app/Activity.html)               | ` getActivity() `                                                                                                                                                                                                                                                                                                                               | | ` boolean`                                                                                           | ` getAllowEnterTransitionOverlap() `                                                                                                                                                                                                                                                                                                            | | ` boolean`                                                                                           | ` getAllowReturnTransitionOverlap() `                                                                                                                                                                                                                                                                                                           | | ` final `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)                    | ` getArguments() `                                                                                                                                                                                                                                                                                                                              | | ` final `[FragmentManager](https://developer.android.com/reference/android/app/FragmentManager.html) | ` getChildFragmentManager() `                                                                                                                                                                                                                                                                                                                   | | ` `[Context](https://developer.android.com/reference/android/content/Context.html)                   | ` getContext() `                                                                                                                                                                                                                                                                                                                                | | ` `[Transition](https://developer.android.com/reference/android/transition/Transition.html)          | ` getEnterTransition() `                                                                                                                                                                                                                                                                                                                        | | ` `[Transition](https://developer.android.com/reference/android/transition/Transition.html)          | ` getExitTransition() `                                                                                                                                                                                                                                                                                                                         | | ` final `[FragmentManager](https://developer.android.com/reference/android/app/FragmentManager.html) | ` getFragmentManager() `                                                                                                                                                                                                                                                                                                                        | | ` final Object`                                                                                      | ` getHost() `                                                                                                                                                                                                                                                                                                                                   | | ` final int`                                                                                         | ` getId() `                                                                                                                                                                                                                                                                                                                                     | | ` final `[LayoutInflater](https://developer.android.com/reference/android/view/LayoutInflater.html)  | ` getLayoutInflater() `                                                                                                                                                                                                                                                                                                                         | | ` `[LoaderManager](https://developer.android.com/reference/android/app/LoaderManager.html)           | ` getLoaderManager() `                                                                                                                                                                                                                                                                                                                          | | ` final `[Fragment](https://developer.android.com/reference/android/app/Fragment.html)               | ` getParentFragment() `                                                                                                                                                                                                                                                                                                                         | | ` `[Transition](https://developer.android.com/reference/android/transition/Transition.html)          | ` getReenterTransition() `                                                                                                                                                                                                                                                                                                                      | | ` final `[Resources](https://developer.android.com/reference/android/content/res/Resources.html)     | ` getResources() `                                                                                                                                                                                                                                                                                                                              | | ` final boolean`                                                                                     | ` getRetainInstance() `                                                                                                                                                                                                                                                                                                                         | | ` `[Transition](https://developer.android.com/reference/android/transition/Transition.html)          | ` getReturnTransition() `                                                                                                                                                                                                                                                                                                                       | | ` `[Transition](https://developer.android.com/reference/android/transition/Transition.html)          | ` getSharedElementEnterTransition() `                                                                                                                                                                                                                                                                                                           | | ` `[Transition](https://developer.android.com/reference/android/transition/Transition.html)          | ` getSharedElementReturnTransition() `                                                                                                                                                                                                                                                                                                          | | ` final String`                                                                                      | ` getString(int arg0, Object... arg1) `                                                                                                                                                                                                                                                                                                         | | ` final String`                                                                                      | ` getString(int arg0) `                                                                                                                                                                                                                                                                                                                         | | ` final String`                                                                                      | ` getTag() `                                                                                                                                                                                                                                                                                                                                    | | ` final `[Fragment](https://developer.android.com/reference/android/app/Fragment.html)               | ` getTargetFragment() `                                                                                                                                                                                                                                                                                                                         | | ` final int`                                                                                         | ` getTargetRequestCode() `                                                                                                                                                                                                                                                                                                                      | | ` final CharSequence`                                                                                | ` getText(int arg0) `                                                                                                                                                                                                                                                                                                                           | | ` boolean`                                                                                           | ` getUserVisibleHint() `                                                                                                                                                                                                                                                                                                                        | | ` `[View](https://developer.android.com/reference/android/view/View.html)                            | ` getView() `                                                                                                                                                                                                                                                                                                                                   | | ` final int`                                                                                         | ` hashCode() `                                                                                                                                                                                                                                                                                                                                  | | ` static `[Fragment](https://developer.android.com/reference/android/app/Fragment.html)              | ` instantiate(`[Context](https://developer.android.com/reference/android/content/Context.html)` arg0, String arg1) `                                                                                                                                                                                                                            | | ` static `[Fragment](https://developer.android.com/reference/android/app/Fragment.html)              | ` instantiate(`[Context](https://developer.android.com/reference/android/content/Context.html)` arg0, String arg1, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg2) `                                                                                                                                           | | ` final boolean`                                                                                     | ` isAdded() `                                                                                                                                                                                                                                                                                                                                   | | ` final boolean`                                                                                     | ` isDetached() `                                                                                                                                                                                                                                                                                                                                | | ` final boolean`                                                                                     | ` isHidden() `                                                                                                                                                                                                                                                                                                                                  | | ` final boolean`                                                                                     | ` isInLayout() `                                                                                                                                                                                                                                                                                                                                | | ` final boolean`                                                                                     | ` isRemoving() `                                                                                                                                                                                                                                                                                                                                | | ` final boolean`                                                                                     | ` isResumed() `                                                                                                                                                                                                                                                                                                                                 | | ` final boolean`                                                                                     | ` isStateSaved() `                                                                                                                                                                                                                                                                                                                              | | ` final boolean`                                                                                     | ` isVisible() `                                                                                                                                                                                                                                                                                                                                 | | ` void`                                                                                              | ` onActivityCreated(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg0) `                                                                                                                                                                                                                                          | | ` void`                                                                                              | ` onActivityResult(int arg0, int arg1, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg2) `                                                                                                                                                                                                                  | | ` void`                                                                                              | ` onAttach(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0) `                                                                                                                                                                                                                                              | | ` void`                                                                                              | ` onAttach(`[Context](https://developer.android.com/reference/android/content/Context.html)` arg0) `                                                                                                                                                                                                                                            | | ` void`                                                                                              | ` onAttachFragment(`[Fragment](https://developer.android.com/reference/android/app/Fragment.html)` arg0) `                                                                                                                                                                                                                                      | | ` void`                                                                                              | ` onConfigurationChanged(`[Configuration](https://developer.android.com/reference/android/content/res/Configuration.html)` arg0) `                                                                                                                                                                                                              | | ` boolean`                                                                                           | ` onContextItemSelected(`[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)` arg0) `                                                                                                                                                                                                                                | | ` void`                                                                                              | ` onCreate(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg0) `                                                                                                                                                                                                                                                   | | ` `[Animator](https://developer.android.com/reference/android/animation/Animator.html)               | ` onCreateAnimator(int arg0, boolean arg1, int arg2) `                                                                                                                                                                                                                                                                                          | | ` void`                                                                                              | ` onCreateContextMenu(`[ContextMenu](https://developer.android.com/reference/android/view/ContextMenu.html)` arg0, `[View](https://developer.android.com/reference/android/view/View.html)` arg1, `[ContextMenu.ContextMenuInfo](https://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo.html)` arg2) `                | | ` void`                                                                                              | ` onCreateOptionsMenu(`[Menu](https://developer.android.com/reference/android/view/Menu.html)` arg0, `[MenuInflater](https://developer.android.com/reference/android/view/MenuInflater.html)` arg1) `                                                                                                                                           | | ` `[View](https://developer.android.com/reference/android/view/View.html)                            | ` onCreateView(`[LayoutInflater](https://developer.android.com/reference/android/view/LayoutInflater.html)` arg0, `[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)` arg1, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg2) `                                                   | | ` void`                                                                                              | ` onDestroy() `                                                                                                                                                                                                                                                                                                                                 | | ` void`                                                                                              | ` onDestroyOptionsMenu() `                                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                              | ` onDestroyView() `                                                                                                                                                                                                                                                                                                                             | | ` void`                                                                                              | ` onDetach() `                                                                                                                                                                                                                                                                                                                                  | | ` `[LayoutInflater](https://developer.android.com/reference/android/view/LayoutInflater.html)        | ` onGetLayoutInflater(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg0) `                                                                                                                                                                                                                                        | | ` void`                                                                                              | ` onHiddenChanged(boolean arg0) `                                                                                                                                                                                                                                                                                                               | | ` void`                                                                                              | ` onInflate(`[AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1) `                                                                                                                                                   | | ` void`                                                                                              | ` onInflate(`[Activity](https://developer.android.com/reference/android/app/Activity.html)` arg0, `[AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html)` arg1, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg2) `                                                             | | ` void`                                                                                              | ` onInflate(`[Context](https://developer.android.com/reference/android/content/Context.html)` arg0, `[AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html)` arg1, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg2) `                                                           | | ` void`                                                                                              | ` onLowMemory() `                                                                                                                                                                                                                                                                                                                               | | ` void`                                                                                              | ` onMultiWindowModeChanged(boolean arg0) `                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                              | ` onMultiWindowModeChanged(boolean arg0, `[Configuration](https://developer.android.com/reference/android/content/res/Configuration.html)` arg1) `                                                                                                                                                                                              | | ` boolean`                                                                                           | ` onOptionsItemSelected(`[MenuItem](https://developer.android.com/reference/android/view/MenuItem.html)` arg0) `                                                                                                                                                                                                                                | | ` void`                                                                                              | ` onOptionsMenuClosed(`[Menu](https://developer.android.com/reference/android/view/Menu.html)` arg0) `                                                                                                                                                                                                                                          | | ` void`                                                                                              | ` onPause() `                                                                                                                                                                                                                                                                                                                                   | | ` void`                                                                                              | ` onPictureInPictureModeChanged(boolean arg0, `[Configuration](https://developer.android.com/reference/android/content/res/Configuration.html)` arg1) `                                                                                                                                                                                         | | ` void`                                                                                              | ` onPictureInPictureModeChanged(boolean arg0) `                                                                                                                                                                                                                                                                                                 | | ` void`                                                                                              | ` onPrepareOptionsMenu(`[Menu](https://developer.android.com/reference/android/view/Menu.html)` arg0) `                                                                                                                                                                                                                                         | | ` void`                                                                                              | ` onRequestPermissionsResult(int arg0, String[] arg1, int[] arg2) `                                                                                                                                                                                                                                                                             | | ` void`                                                                                              | ` onResume() `                                                                                                                                                                                                                                                                                                                                  | | ` void`                                                                                              | ` onSaveInstanceState(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg0) `                                                                                                                                                                                                                                        | | ` void`                                                                                              | ` onStart() `                                                                                                                                                                                                                                                                                                                                   | | ` void`                                                                                              | ` onStop() `                                                                                                                                                                                                                                                                                                                                    | | ` void`                                                                                              | ` onTrimMemory(int arg0) `                                                                                                                                                                                                                                                                                                                      | | ` void`                                                                                              | ` onViewCreated(`[View](https://developer.android.com/reference/android/view/View.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1) `                                                                                                                                                               | | ` void`                                                                                              | ` onViewStateRestored(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg0) `                                                                                                                                                                                                                                        | | ` void`                                                                                              | ` postponeEnterTransition() `                                                                                                                                                                                                                                                                                                                   | | ` void`                                                                                              | ` registerForContextMenu(`[View](https://developer.android.com/reference/android/view/View.html)` arg0) `                                                                                                                                                                                                                                       | | ` final void`                                                                                        | ` requestPermissions(String[] arg0, int arg1) `                                                                                                                                                                                                                                                                                                 | | ` void`                                                                                              | ` setAllowEnterTransitionOverlap(boolean arg0) `                                                                                                                                                                                                                                                                                                | | ` void`                                                                                              | ` setAllowReturnTransitionOverlap(boolean arg0) `                                                                                                                                                                                                                                                                                               | | ` void`                                                                                              | ` setArguments(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg0) `                                                                                                                                                                                                                                               | | ` void`                                                                                              | ` setEnterSharedElementCallback(`[SharedElementCallback](https://developer.android.com/reference/android/app/SharedElementCallback.html)` arg0) `                                                                                                                                                                                               | | ` void`                                                                                              | ` setEnterTransition(`[Transition](https://developer.android.com/reference/android/transition/Transition.html)` arg0) `                                                                                                                                                                                                                         | | ` void`                                                                                              | ` setExitSharedElementCallback(`[SharedElementCallback](https://developer.android.com/reference/android/app/SharedElementCallback.html)` arg0) `                                                                                                                                                                                                | | ` void`                                                                                              | ` setExitTransition(`[Transition](https://developer.android.com/reference/android/transition/Transition.html)` arg0) `                                                                                                                                                                                                                          | | ` void`                                                                                              | ` setHasOptionsMenu(boolean arg0) `                                                                                                                                                                                                                                                                                                             | | ` void`                                                                                              | ` setInitialSavedState(`[Fragment.SavedState](https://developer.android.com/reference/android/app/Fragment.SavedState.html)` arg0) `                                                                                                                                                                                                            | | ` void`                                                                                              | ` setMenuVisibility(boolean arg0) `                                                                                                                                                                                                                                                                                                             | | ` void`                                                                                              | ` setReenterTransition(`[Transition](https://developer.android.com/reference/android/transition/Transition.html)` arg0) `                                                                                                                                                                                                                       | | ` void`                                                                                              | ` setRetainInstance(boolean arg0) `                                                                                                                                                                                                                                                                                                             | | ` void`                                                                                              | ` setReturnTransition(`[Transition](https://developer.android.com/reference/android/transition/Transition.html)` arg0) `                                                                                                                                                                                                                        | | ` void`                                                                                              | ` setSharedElementEnterTransition(`[Transition](https://developer.android.com/reference/android/transition/Transition.html)` arg0) `                                                                                                                                                                                                            | | ` void`                                                                                              | ` setSharedElementReturnTransition(`[Transition](https://developer.android.com/reference/android/transition/Transition.html)` arg0) `                                                                                                                                                                                                           | | ` void`                                                                                              | ` setTargetFragment(`[Fragment](https://developer.android.com/reference/android/app/Fragment.html)` arg0, int arg1) `                                                                                                                                                                                                                           | | ` void`                                                                                              | ` setUserVisibleHint(boolean arg0) `                                                                                                                                                                                                                                                                                                            | | ` boolean`                                                                                           | ` shouldShowRequestPermissionRationale(String arg0) `                                                                                                                                                                                                                                                                                           | | ` void`                                                                                              | ` startActivity(`[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg0) `                                                                                                                                                                                                                                         | | ` void`                                                                                              | ` startActivity(`[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg0, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg1) `                                                                                                                                                        | | ` void`                                                                                              | ` startActivityForResult(`[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg0, int arg1) `                                                                                                                                                                                                                      | | ` void`                                                                                              | ` startActivityForResult(`[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg0, int arg1, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg2) `                                                                                                                                     | | ` void`                                                                                              | ` startIntentSenderForResult(`[IntentSender](https://developer.android.com/reference/android/content/IntentSender.html)` arg0, int arg1, `[Intent](https://developer.android.com/reference/android/content/Intent.html)` arg2, int arg3, int arg4, int arg5, `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` arg6) ` | | ` void`                                                                                              | ` startPostponedEnterTransition() `                                                                                                                                                                                                                                                                                                             | | ` String`                                                                                            | ` toString() `                                                                                                                                                                                                                                                                                                                                  | | ` void`                                                                                              | ` unregisterForContextMenu(`[View](https://developer.android.com/reference/android/view/View.html)` arg0) `                                                                                                                                                                                                                                     | ||
  | [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||
  | [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#)From interface` `[android.content.ComponentCallbacks2](https://developer.android.com/reference/android/content/ComponentCallbacks2.html)` ` |------------------|----------------------------| | ` abstract void` | ` onTrimMemory(int arg0) ` | ||
  | [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#)From interface` `[android.view.View.OnCreateContextMenuListener](https://developer.android.com/reference/android/view/View.OnCreateContextMenuListener.html)` ` |------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` onCreateContextMenu(`[ContextMenu](https://developer.android.com/reference/android/view/ContextMenu.html)` arg0, `[View](https://developer.android.com/reference/android/view/View.html)` arg1, `[ContextMenu.ContextMenuInfo](https://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo.html)` arg2) ` | ||
  | [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#)From interface` `[android.support.v7.preference.PreferenceManager.OnPreferenceTreeClickListener](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager.OnPreferenceTreeClickListener)` ` |---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract boolean` | ` `[onPreferenceTreeClick](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager.OnPreferenceTreeClickListener#onPreferenceTreeClick(android.support.v7.preference.Preference))`(`[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)` preference) ` Called when a preference in the tree rooted at this[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)has been clicked. | ||
  | [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#)From interface` `[android.support.v7.preference.PreferenceManager.OnDisplayPreferenceDialogListener](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager.OnDisplayPreferenceDialogListener)` ` |------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[onDisplayPreferenceDialog](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager.OnDisplayPreferenceDialogListener#onDisplayPreferenceDialog(android.support.v7.preference.Preference))`(`[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)` preference) ` Called when a preference in the tree requests to display a dialog. | ||
  | [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#)From interface` `[android.support.v7.preference.PreferenceManager.OnNavigateToScreenListener](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager.OnNavigateToScreenListener)` ` |------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[onNavigateToScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager.OnNavigateToScreenListener#onNavigateToScreen(android.support.v7.preference.PreferenceScreen))`(`[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)` preferenceScreen) ` Called when a PreferenceScreen in the tree requests to navigate to its contents. | ||
  | [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#)From interface` `[android.support.v7.preference.DialogPreference.TargetFragment](https://developer.android.com/reference/android/support/v7/preference/DialogPreference.TargetFragment)` ` |------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract `[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference) | ` `[findPreference](https://developer.android.com/reference/android/support/v7/preference/DialogPreference.TargetFragment#findPreference(java.lang.CharSequence))`(CharSequence key) ` | ||
  | [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#)From interface` `[android.content.ComponentCallbacks](https://developer.android.com/reference/android/content/ComponentCallbacks.html)` ` |------------------|------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` onConfigurationChanged(`[Configuration](https://developer.android.com/reference/android/content/res/Configuration.html)` arg0) ` | | ` abstract void` | ` onLowMemory() `                                                                                                                  | ||

  ## XML attributes

  ### PreferenceFragment_android_divider

  <br />

  <br />

  **Related methods:**
  - [setDivider(Drawable)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#setDivider(android.graphics.drawable.Drawable))

  ### PreferenceFragment_android_dividerHeight

  <br />

  <br />

  **Related methods:**
  - [setDividerHeight(int)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#setDividerHeight(int))

  ## Constants

  ### ARG_PREFERENCE_ROOT

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  String ARG_PREFERENCE_ROOT
  ```

  Fragment argument used to specify the tag of the desired root[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)object.

  <br />

  Constant Value: "android.support.v7.preference.PreferenceFragmentCompat.PREFERENCE_ROOT"

  ## Public constructors

  ### PreferenceFragment

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  PreferenceFragment ()
  ```

  <br />

  <br />

  ## Public methods

  ### addPreferencesFromResource

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  void addPreferencesFromResource (int preferencesResId)
  ```

  Inflates the given XML resource and adds the preference hierarchy to the current preference hierarchy.

  <br />

  |                            Parameters                             ||
  |--------------------|-----------------------------------------------|
  | `preferencesResId` | `int`: The XML resource ID to inflate. <br /> |

  ### findPreference

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  Preference findPreference (CharSequence key)
  ```

  Finds a[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)based on its key.

  <br />

  |                              Parameters                              ||
  |-------|---------------------------------------------------------------|
  | `key` | `CharSequence`: The key of the preference to retrieve. <br /> |

  |                                                                                                            Returns                                                                                                             ||
  |------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
  | [Preference](https://developer.android.com/reference/android/support/v7/preference/Preference) | The[Preference](https://developer.android.com/reference/android/support/v7/preference/Preference)with the key, or null. <br /> |

  **See also:**
  - [findPreference(CharSequence)](https://developer.android.com/reference/android/support/v7/preference/PreferenceGroup#findPreference(java.lang.CharSequence))  

  ### getListView

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  RecyclerView getListView ()
  ```

  <br />

  <br />

  |                                                Returns                                                 ||
  |------------------------------------------------------------------------------------------------|--------|
  | [RecyclerView](https://developer.android.com/reference/android/support/v7/widget/RecyclerView) | <br /> |

  ### getPreferenceManager

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  PreferenceManager getPreferenceManager ()
  ```

  Returns the[PreferenceManager](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager)used by this fragment.

  <br />

  |                                                                                                                Returns                                                                                                                ||
  |--------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|
  | [PreferenceManager](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager) | The[PreferenceManager](https://developer.android.com/reference/android/support/v7/preference/PreferenceManager). <br /> |

  ### getPreferenceScreen

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  PreferenceScreen getPreferenceScreen ()
  ```

  Gets the root of the preference hierarchy that this fragment is showing.

  <br />

  |                                                                                                                                    Returns                                                                                                                                    ||
  |------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  | [PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen) | The[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)that is the root of the preference hierarchy. <br /> |

  ### onActivityCreated

  ```
  void onActivityCreated (Bundle savedInstanceState)
  ```

  <br />

  <br />

  |              Parameters               ||
  |----------------------|-----------------|
  | `savedInstanceState` | `Bundle` <br /> |

  ### onCreate

  ```
  void onCreate (Bundle savedInstanceState)
  ```

  <br />

  <br />

  |              Parameters               ||
  |----------------------|-----------------|
  | `savedInstanceState` | `Bundle` <br /> |

  ### onCreateLayoutManager

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  RecyclerView.LayoutManager onCreateLayoutManager ()
  ```

  Called from[onCreateRecyclerView(LayoutInflater, ViewGroup, Bundle)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onCreateRecyclerView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle))to create the[RecyclerView.LayoutManager](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutManager)for the created[RecyclerView](https://developer.android.com/reference/android/support/v7/widget/RecyclerView).

  <br />

  |                                                                                                                                   Returns                                                                                                                                   ||
  |----------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
  | [RecyclerView.LayoutManager](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutManager) | A new[RecyclerView.LayoutManager](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutManager)instance. <br /> |

  ### onCreatePreferences

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  void onCreatePreferences (Bundle savedInstanceState, 
                  String rootKey)
  ```

  Called during[onCreate(Bundle)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#onCreate(android.os.Bundle))to supply the preferences for this fragment. Subclasses are expected to call[setPreferenceScreen(PreferenceScreen)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#setPreferenceScreen(android.support.v7.preference.PreferenceScreen))either directly or via helper methods such as[addPreferencesFromResource(int)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#addPreferencesFromResource(int)).

  <br />

  |                                                                                                          Parameters                                                                                                          ||
  |----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  | `savedInstanceState` | `Bundle`: If the fragment is being re-created from a previous saved state, this is the state. <br />                                                                                                   |
  | `rootKey`            | `String`: If non-null, this preference fragment should be rooted at the[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)with this key. <br /> |

  ### onCreateRecyclerView

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  RecyclerView onCreateRecyclerView (LayoutInflater inflater, 
                  ViewGroup parent, 
                  Bundle savedInstanceState)
  ```

  Creates the[RecyclerView](https://developer.android.com/reference/android/support/v7/widget/RecyclerView)used to display the preferences. Subclasses may override this to return a customized[RecyclerView](https://developer.android.com/reference/android/support/v7/widget/RecyclerView).

  <br />

  |                                                                                                                                   Parameters                                                                                                                                    ||
  |----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  | `inflater`           | `LayoutInflater`: The LayoutInflater object that can be used to inflate the[RecyclerView](https://developer.android.com/reference/android/support/v7/widget/RecyclerView). <br />                                                                         |
  | `parent`             | `ViewGroup`: The parent[View](https://developer.android.com/reference/android/view/View.html)that the RecyclerView will be attached to. This method should not add the view itself, but this can be used to generate the LayoutParams of the view. <br /> |
  | `savedInstanceState` | `Bundle`: If non-null, this view is being re-constructed from a previous saved state as given here <br />                                                                                                                                                 |

  |                                                                                Returns                                                                                ||
  |------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------|
  | [RecyclerView](https://developer.android.com/reference/android/support/v7/widget/RecyclerView) | A new RecyclerView object to be placed into the view hierarchy <br /> |

  ### onCreateView

  ```
  View onCreateView (LayoutInflater inflater, 
                  ViewGroup container, 
                  Bundle savedInstanceState)
  ```

  <br />

  <br />

  |                  Parameters                   ||
  |----------------------|-------------------------|
  | `inflater`           | `LayoutInflater` <br /> |
  | `container`          | `ViewGroup` <br />      |
  | `savedInstanceState` | `Bundle` <br />         |

  |                                    Returns                                     ||
  |------------------------------------------------------------------------|--------|
  | [View](https://developer.android.com/reference/android/view/View.html) | <br /> |

  ### onDestroyView

  ```
  void onDestroyView ()
  ```

  <br />

  <br />

  ### onDisplayPreferenceDialog

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  void onDisplayPreferenceDialog (Preference preference)
  ```

  Called when a preference in the tree requests to display a dialog. Subclasses should override this method to display custom dialogs or to handle dialogs for custom preference classes.

  <br />

  |                                   Parameters                                    ||
  |--------------|-------------------------------------------------------------------|
  | `preference` | `Preference`: The Preference object requesting the dialog. <br /> |

  ### onNavigateToScreen

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  void onNavigateToScreen (PreferenceScreen preferenceScreen)
  ```

  Called by[onClick()](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen#onClick())in order to navigate to a new screen of preferences. Calls[onPreferenceStartScreen(PreferenceFragment, PreferenceScreen)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment.OnPreferenceStartScreenCallback#onPreferenceStartScreen(android.support.v14.preference.PreferenceFragment, android.support.v7.preference.PreferenceScreen))if the target fragment or containing activity implements[PreferenceFragment.OnPreferenceStartScreenCallback](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment.OnPreferenceStartScreenCallback).

  <br />

  |                                                                                 Parameters                                                                                  ||
  |--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
  | `preferenceScreen` | `PreferenceScreen`: The[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)to navigate to. <br /> |

  ### onPreferenceTreeClick

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  boolean onPreferenceTreeClick (Preference preference)
  ```

  Called when a preference in the tree rooted at this[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)has been clicked.

  <br />

  |                             Parameters                              ||
  |--------------|-------------------------------------------------------|
  | `preference` | `Preference`: The preference that was clicked. <br /> |

  |                     Returns                      ||
  |-----------|---------------------------------------|
  | `boolean` | Whether the click was handled. <br /> |

  ### onSaveInstanceState

  ```
  void onSaveInstanceState (Bundle outState)
  ```

  <br />

  <br />

  |         Parameters          ||
  |------------|-----------------|
  | `outState` | `Bundle` <br /> |

  ### onStart

  ```
  void onStart ()
  ```

  <br />

  <br />

  ### onStop

  ```
  void onStop ()
  ```

  <br />

  <br />

  ### onViewCreated

  ```
  void onViewCreated (View view, 
                  Bundle savedInstanceState)
  ```

  <br />

  <br />

  |              Parameters               ||
  |----------------------|-----------------|
  | `view`               | `View` <br />   |
  | `savedInstanceState` | `Bundle` <br /> |

  ### scrollToPreference

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  void scrollToPreference (Preference preference)
  ```

  <br />

  <br />

  |            Parameters             ||
  |--------------|---------------------|
  | `preference` | `Preference` <br /> |

  ### scrollToPreference

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  void scrollToPreference (String key)
  ```

  <br />

  <br />

  |       Parameters       ||
  |-------|-----------------|
  | `key` | `String` <br /> |

  ### setDivider

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  void setDivider (Drawable divider)
  ```

  Sets the drawable that will be drawn between each item in the list.

  **Note:** If the drawable does not have an intrinsic height, you should also call[setDividerHeight(int)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#setDividerHeight(int)).

  <br />

  **Related XML Attributes:**
  - [PreferenceFragment_android_divider](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#attr_PreferenceFragment_android_divider)

  |                    Parameters                     ||
  |-----------|----------------------------------------|
  | `divider` | `Drawable`: the drawable to use <br /> |

  ### setDividerHeight

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  void setDividerHeight (int height)
  ```

  Sets the height of the divider that will be drawn between each item in the list. Calling this will override the intrinsic height as set by[setDivider(Drawable)](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#setDivider(android.graphics.drawable.Drawable))

  <br />

  **Related XML Attributes:**
  - [PreferenceFragment_android_dividerHeight](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment#attr_PreferenceFragment_android_dividerHeight)

  |                            Parameters                            ||
  |----------|--------------------------------------------------------|
  | `height` | `int`: The new height of the divider in pixels. <br /> |

  ### setPreferenceScreen

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  void setPreferenceScreen (PreferenceScreen preferenceScreen)
  ```

  Sets the root of the preference hierarchy that this fragment is showing.

  <br />

  |                                                                                          Parameters                                                                                           ||
  |--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  | `preferenceScreen` | `PreferenceScreen`: The root[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)of the preference hierarchy. <br /> |

  ### setPreferencesFromResource

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  void setPreferencesFromResource (int preferencesResId, 
                  String key)
  ```

  Inflates the given XML resource and replaces the current preference hierarchy (if any) with the preference hierarchy rooted at`key`.

  <br />

  |                                                                                                                                                                         Parameters                                                                                                                                                                         ||
  |--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  | `preferencesResId` | `int`: The XML resource ID to inflate. <br />                                                                                                                                                                                                                                                                                          |
  | `key`              | `String`: The preference key of the[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen)to use as the root of the preference hierarchy, or null to use the root[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen). <br /> |

  ## Protected methods

  ### onCreateAdapter

  added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

  ```
  Adapter onCreateAdapter (PreferenceScreen preferenceScreen)
  ```

  Creates the root adapter.

  <br />

  |                                             Parameters                                             ||
  |--------------------|--------------------------------------------------------------------------------|
  | `preferenceScreen` | `PreferenceScreen`: Preference screen object to create the adapter for. <br /> |

  |                                                                                                                                     Returns                                                                                                                                     ||
  |---------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  | [Adapter](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter) | An adapter that contains the preferences contained in this[PreferenceScreen](https://developer.android.com/reference/android/support/v7/preference/PreferenceScreen). <br /> |

-

  ## Interfaces

  - [PreferenceFragment.OnPreferenceDisplayDialogCallback](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment.OnPreferenceDisplayDialogCallback)
  - [PreferenceFragment.OnPreferenceStartFragmentCallback](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment.OnPreferenceStartFragmentCallback)
  - [PreferenceFragment.OnPreferenceStartScreenCallback](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment.OnPreferenceStartScreenCallback)
-

  ## Classes

  - [EditTextPreferenceDialogFragment](https://developer.android.com/reference/android/support/v14/preference/EditTextPreferenceDialogFragment)
  - [ListPreferenceDialogFragment](https://developer.android.com/reference/android/support/v14/preference/ListPreferenceDialogFragment)
  - [MultiSelectListPreference](https://developer.android.com/reference/android/support/v14/preference/MultiSelectListPreference)
  - [MultiSelectListPreferenceDialogFragment](https://developer.android.com/reference/android/support/v14/preference/MultiSelectListPreferenceDialogFragment)
  - [PreferenceDialogFragment](https://developer.android.com/reference/android/support/v14/preference/PreferenceDialogFragment)
  - [PreferenceFragment](https://developer.android.com/reference/android/support/v14/preference/PreferenceFragment)
  - [R](https://developer.android.com/reference/android/support/v14/preference/R)
  - [R.anim](https://developer.android.com/reference/android/support/v14/preference/R.anim)
  - [R.attr](https://developer.android.com/reference/android/support/v14/preference/R.attr)
  - [R.bool](https://developer.android.com/reference/android/support/v14/preference/R.bool)
  - [R.color](https://developer.android.com/reference/android/support/v14/preference/R.color)
  - [R.dimen](https://developer.android.com/reference/android/support/v14/preference/R.dimen)
  - [R.drawable](https://developer.android.com/reference/android/support/v14/preference/R.drawable)
  - [R.id](https://developer.android.com/reference/android/support/v14/preference/R.id)
  - [R.integer](https://developer.android.com/reference/android/support/v14/preference/R.integer)
  - [R.layout](https://developer.android.com/reference/android/support/v14/preference/R.layout)
  - [R.string](https://developer.android.com/reference/android/support/v14/preference/R.string)
  - [R.style](https://developer.android.com/reference/android/support/v14/preference/R.style)
  - [R.styleable](https://developer.android.com/reference/android/support/v14/preference/R.styleable)
  - [SwitchPreference](https://developer.android.com/reference/android/support/v14/preference/SwitchPreference)