Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/preference/PreferenceFragment#nestedclasses) \| [Inherited XML Attrs](https://developer.android.com/reference/android/preference/PreferenceFragment#inhattrs) \| [Inherited Constants](https://developer.android.com/reference/android/preference/PreferenceFragment#inhconstants) \| [Ctors](https://developer.android.com/reference/android/preference/PreferenceFragment#pubctors) \| [Methods](https://developer.android.com/reference/android/preference/PreferenceFragment#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/preference/PreferenceFragment#inhmethods)

# PreferenceFragment

*** ** * ** ***

` public abstract class PreferenceFragment `   
` ` ` extends https://developer.android.com/reference/android/app/Fragment ` ` `

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

<br />

*** ** * ** ***

<br />

**This class was deprecated in API level 28.**   

Use the [AndroidX](https://developer.android.com/jetpack/androidx) [Preference Library](https://developer.android.com/reference/androidx/preference/package-summary) for consistent behavior across all devices. For more information on using the AndroidX Preference Library see [Settings](https://developer.android.com/guide/topics/ui/settings).

Shows a hierarchy of `https://developer.android.com/reference/android/preference/Preference` objects as lists. These preferences will automatically save to `https://developer.android.com/reference/android/content/SharedPreferences` as the user interacts with them. To retrieve an instance of `https://developer.android.com/reference/android/content/SharedPreferences` that the preference hierarchy in this fragment will use, call `https://developer.android.com/reference/android/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 `https://developer.android.com/reference/android/preference/PreferenceScreen` object should be at the top of the preference hierarchy. Furthermore, subsequent `https://developer.android.com/reference/android/preference/PreferenceScreen` in the hierarchy denote a screen break--that is the preferences contained within subsequent `https://developer.android.com/reference/android/preference/PreferenceScreen` should be shown on another screen. The preference framework handles showing these other screens from the preference hierarchy.

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

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

  To specify an `https://developer.android.com/reference/android/content/Intent` to query `https://developer.android.com/reference/android/app/Activity` that each have preferences, use `https://developer.android.com/reference/android/preference/PreferenceFragment#addPreferencesFromIntent(android.content.Intent)`. Each `https://developer.android.com/reference/android/app/Activity` can specify meta-data in the manifest (via the key `https://developer.android.com/reference/android/preference/PreferenceManager#METADATA_KEY_PREFERENCES`) that points to an XML resource. These XML resources will be inflated into a single preference hierarchy and shown by this fragment.

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

  As a convenience, this fragment implements a click listener for any preference in the current hierarchy, see `https://developer.android.com/reference/android/preference/PreferenceFragment#onPreferenceTreeClick(android.preference.PreferenceScreen,%20android.preference.Preference)`.

  ### Developer Guides

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

  <br />

  **See also:**
  - `https://developer.android.com/reference/android/preference/Preference`
  - `https://developer.android.com/reference/android/preference/PreferenceScreen`

  ## Summary

  | ### Nested classes ||
  |---|---|
  | ` interface` | `https://developer.android.com/reference/android/preference/PreferenceFragment.OnPreferenceStartFragmentCallback` *This interface was deprecated in API level 28. Use `https://developer.android.com/reference/androidx/preference/PreferenceFragmentCompat.OnPreferenceStartFragmentCallback.html`* |

  ### Inherited XML attributes

  From class `https://developer.android.com/reference/android/app/Fragment` [`android:fragmentAllowEnterTransitionOverlap`](https://developer.android.com/reference/android/app/Fragment#attr_android:fragmentAllowEnterTransitionOverlap) Sets whether the enter and exit transitions should overlap when transitioning forward. [`android:fragmentAllowReturnTransitionOverlap`](https://developer.android.com/reference/android/app/Fragment#attr_android:fragmentAllowReturnTransitionOverlap) Sets whether the enter and exit transitions should overlap when transitioning because of popping the back stack. [`android:fragmentEnterTransition`](https://developer.android.com/reference/android/app/Fragment#attr_android:fragmentEnterTransition) The Transition that will be used to move Views into the initial scene. [`android:fragmentExitTransition`](https://developer.android.com/reference/android/app/Fragment#attr_android:fragmentExitTransition) The Transition that will be used to move Views out of the scene when the fragment is removed, hidden, or detached when not popping the back stack. [`android:fragmentReenterTransition`](https://developer.android.com/reference/android/app/Fragment#attr_android:fragmentReenterTransition) The Transition that will be used to move Views in to the scene when returning due to popping a back stack. [`android:fragmentSharedElementEnterTransition`](https://developer.android.com/reference/android/app/Fragment#attr_android:fragmentSharedElementEnterTransition) The Transition that will be used for shared elements transferred into the content Scene. [`android:fragmentSharedElementReturnTransition`](https://developer.android.com/reference/android/app/Fragment#attr_android:fragmentSharedElementReturnTransition) The Transition that will be used for shared elements transferred back during a pop of the back stack.

  ### Inherited constants

  From interface `https://developer.android.com/reference/android/content/ComponentCallbacks2` `int` `https://developer.android.com/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_BACKGROUND`

  Level for `https://developer.android.com/reference/android/content/ComponentCallbacks2#onTrimMemory(int)`: the process has gone on to the LRU list.
  `int` `https://developer.android.com/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_COMPLETE`

  *This constant was deprecated in API level 35. Apps are not notified of this level since API level 34*
  `int` `https://developer.android.com/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_MODERATE`

  *This constant was deprecated in API level 35. Apps are not notified of this level since API level 34*
  `int` `https://developer.android.com/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_RUNNING_CRITICAL`

  *This constant was deprecated in API level 35. Apps are not notified of this level since API level 34*
  `int` `https://developer.android.com/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_RUNNING_LOW`

  *This constant was deprecated in API level 35. Apps are not notified of this level since API level 34*
  `int` `https://developer.android.com/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_RUNNING_MODERATE`

  *This constant was deprecated in API level 35. Apps are not notified of this level since API level 34*
  `int` `https://developer.android.com/reference/android/content/ComponentCallbacks2#TRIM_MEMORY_UI_HIDDEN`

  Level for `https://developer.android.com/reference/android/content/ComponentCallbacks2#onTrimMemory(int)`: the process had been showing a user interface, and is no longer doing so.

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

  | ### Public methods ||
  |---|---|
  | ` void` | ` https://developer.android.com/reference/android/preference/PreferenceFragment#addPreferencesFromIntent(android.content.Intent)(https://developer.android.com/reference/android/content/Intent intent) ` Adds preferences from activities that match the given `https://developer.android.com/reference/android/content/Intent`. |
  | ` void` | ` https://developer.android.com/reference/android/preference/PreferenceFragment#addPreferencesFromResource(int)(int preferencesResId) ` Inflates the given XML resource and adds the preference hierarchy to the current preference hierarchy. |
  | ` https://developer.android.com/reference/android/preference/Preference` | ` https://developer.android.com/reference/android/preference/PreferenceFragment#findPreference(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence key) ` Finds a `https://developer.android.com/reference/android/preference/Preference` based on its key. |
  | ` https://developer.android.com/reference/android/preference/PreferenceManager` | ` https://developer.android.com/reference/android/preference/PreferenceFragment#getPreferenceManager()() ` Returns the `https://developer.android.com/reference/android/preference/PreferenceManager` used by this fragment. |
  | ` https://developer.android.com/reference/android/preference/PreferenceScreen` | ` https://developer.android.com/reference/android/preference/PreferenceFragment#getPreferenceScreen()() ` Gets the root of the preference hierarchy that this fragment is showing. |
  | ` void` | ` https://developer.android.com/reference/android/preference/PreferenceFragment#onActivityCreated(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState) ` Called when the fragment's activity has been created and this fragment's view hierarchy instantiated. |
  | ` void` | ` https://developer.android.com/reference/android/preference/PreferenceFragment#onActivityResult(int,%20int,%20android.content.Intent)(int requestCode, int resultCode, https://developer.android.com/reference/android/content/Intent data) ` Receive the result from a previous call to `https://developer.android.com/reference/android/app/Fragment#startActivityForResult(android.content.Intent,%20int)`. |
  | ` void` | ` https://developer.android.com/reference/android/preference/PreferenceFragment#onCreate(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState) ` Called to do initial creation of a fragment. |
  | ` https://developer.android.com/reference/android/view/View` | ` https://developer.android.com/reference/android/preference/PreferenceFragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)(https://developer.android.com/reference/android/view/LayoutInflater inflater, https://developer.android.com/reference/android/view/ViewGroup container, https://developer.android.com/reference/android/os/Bundle savedInstanceState) ` Called to have the fragment instantiate its user interface view. |
  | ` void` | ` https://developer.android.com/reference/android/preference/PreferenceFragment#onDestroy()() ` Called when the fragment is no longer in use. |
  | ` void` | ` https://developer.android.com/reference/android/preference/PreferenceFragment#onDestroyView()() ` Called when the view previously created by `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)` has been detached from the fragment. |
  | ` boolean` | ` https://developer.android.com/reference/android/preference/PreferenceFragment#onPreferenceTreeClick(android.preference.PreferenceScreen,%20android.preference.Preference)(https://developer.android.com/reference/android/preference/PreferenceScreen preferenceScreen, https://developer.android.com/reference/android/preference/Preference preference) ` <br /> |
  | ` void` | ` https://developer.android.com/reference/android/preference/PreferenceFragment#onSaveInstanceState(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle outState) ` Called to ask the fragment to save its current dynamic state, so it can later be reconstructed in a new instance of its process is restarted. |
  | ` void` | ` https://developer.android.com/reference/android/preference/PreferenceFragment#onStart()() ` Called when the Fragment is visible to the user. |
  | ` void` | ` https://developer.android.com/reference/android/preference/PreferenceFragment#onStop()() ` Called when the Fragment is no longer started. |
  | ` void` | ` https://developer.android.com/reference/android/preference/PreferenceFragment#onViewCreated(android.view.View,%20android.os.Bundle)(https://developer.android.com/reference/android/view/View view, https://developer.android.com/reference/android/os/Bundle savedInstanceState) ` Called immediately after `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)` has returned, but before any saved state has been restored in to the view. |
  | ` void` | ` https://developer.android.com/reference/android/preference/PreferenceFragment#setPreferenceScreen(android.preference.PreferenceScreen)(https://developer.android.com/reference/android/preference/PreferenceScreen preferenceScreen) ` Sets the root of the preference hierarchy that this fragment is showing. |

  ### Inherited methods

  From class ` https://developer.android.com/reference/android/app/Fragment ` ` void` ` https://developer.android.com/reference/android/app/Fragment#dump(java.lang.String,%20java.io.FileDescriptor,%20java.io.PrintWriter,%20java.lang.String[])(https://developer.android.com/reference/java/lang/String prefix, https://developer.android.com/reference/java/io/FileDescriptor fd, https://developer.android.com/reference/java/io/PrintWriter writer, https://developer.android.com/reference/java/lang/String args) `

  Print the Fragments's state into the given stream.
  ` final boolean` ` https://developer.android.com/reference/android/app/Fragment#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) `

  Subclasses can not override equals().
  ` final https://developer.android.com/reference/android/app/Activity` ` https://developer.android.com/reference/android/app/Fragment#getActivity()() `

  Return the Activity this fragment is currently associated with.
  ` boolean` ` https://developer.android.com/reference/android/app/Fragment#getAllowEnterTransitionOverlap()() `

  Returns whether the exit transition and enter transition overlap or not.
  ` boolean` ` https://developer.android.com/reference/android/app/Fragment#getAllowReturnTransitionOverlap()() `

  Returns whether the return transition and reenter transition overlap or not.
  ` final https://developer.android.com/reference/android/os/Bundle` ` https://developer.android.com/reference/android/app/Fragment#getArguments()() `

  Return the arguments supplied to `https://developer.android.com/reference/android/app/Fragment#setArguments(android.os.Bundle)`, if any.
  ` final https://developer.android.com/reference/android/app/FragmentManager` ` https://developer.android.com/reference/android/app/Fragment#getChildFragmentManager()() `

  Return a private FragmentManager for placing and managing Fragments inside of this Fragment.
  ` https://developer.android.com/reference/android/content/Context` ` https://developer.android.com/reference/android/app/Fragment#getContext()() `

  Return the `https://developer.android.com/reference/android/content/Context` this fragment is currently associated with.
  ` https://developer.android.com/reference/android/transition/Transition` ` https://developer.android.com/reference/android/app/Fragment#getEnterTransition()() `

  Returns the Transition that will be used to move Views into the initial scene.
  ` https://developer.android.com/reference/android/transition/Transition` ` https://developer.android.com/reference/android/app/Fragment#getExitTransition()() `

  Returns the Transition that will be used to move Views out of the scene when the fragment is removed, hidden, or detached when not popping the back stack.
  ` final https://developer.android.com/reference/android/app/FragmentManager` ` https://developer.android.com/reference/android/app/Fragment#getFragmentManager()() `

  Return the FragmentManager for interacting with fragments associated with this fragment's activity.
  ` final https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/android/app/Fragment#getHost()() `

  Return the host object of this fragment.
  ` final int` ` https://developer.android.com/reference/android/app/Fragment#getId()() `

  Return the identifier this fragment is known by.
  ` final https://developer.android.com/reference/android/view/LayoutInflater` ` https://developer.android.com/reference/android/app/Fragment#getLayoutInflater()() `

  Returns the cached LayoutInflater used to inflate Views of this Fragment.
  ` https://developer.android.com/reference/android/app/LoaderManager` ` https://developer.android.com/reference/android/app/Fragment#getLoaderManager()() `

  *This method is deprecated. Use `https://developer.android.com/reference/androidx/fragment/app/Fragment.html#getLoaderManager()`*
  ` final https://developer.android.com/reference/android/app/Fragment` ` https://developer.android.com/reference/android/app/Fragment#getParentFragment()() `

  Returns the parent Fragment containing this Fragment.
  ` https://developer.android.com/reference/android/transition/Transition` ` https://developer.android.com/reference/android/app/Fragment#getReenterTransition()() `

  Returns the Transition that will be used to move Views in to the scene when returning due to popping a back stack.
  ` final https://developer.android.com/reference/android/content/res/Resources` ` https://developer.android.com/reference/android/app/Fragment#getResources()() `

  Return `getActivity().getResources()`.
  ` final boolean` ` https://developer.android.com/reference/android/app/Fragment#getRetainInstance()() ` ` https://developer.android.com/reference/android/transition/Transition` ` https://developer.android.com/reference/android/app/Fragment#getReturnTransition()() `

  Returns the Transition that will be used to move Views out of the scene when the Fragment is preparing to be removed, hidden, or detached because of popping the back stack.
  ` https://developer.android.com/reference/android/transition/Transition` ` https://developer.android.com/reference/android/app/Fragment#getSharedElementEnterTransition()() `

  Returns the Transition that will be used for shared elements transferred into the content Scene.
  ` https://developer.android.com/reference/android/transition/Transition` ` https://developer.android.com/reference/android/app/Fragment#getSharedElementReturnTransition()() `

  Return the Transition that will be used for shared elements transferred back during a pop of the back stack.
  ` final https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/android/app/Fragment#getString(int)(int resId) `

  Return a localized string from the application's package's default string table.
  ` final https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/android/app/Fragment#getString(int,%20java.lang.Object[])(int resId, https://developer.android.com/reference/java/lang/Object formatArgs) `

  Return a localized formatted string from the application's package's default string table, substituting the format arguments as defined in `https://developer.android.com/reference/java/util/Formatter` and `https://developer.android.com/reference/java/lang/String#format(java.lang.String,%20java.lang.Object[])`.
  ` final https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/android/app/Fragment#getTag()() `

  Get the tag name of the fragment, if specified.
  ` final https://developer.android.com/reference/android/app/Fragment` ` https://developer.android.com/reference/android/app/Fragment#getTargetFragment()() `

  Return the target fragment set by `https://developer.android.com/reference/android/app/Fragment#setTargetFragment(android.app.Fragment,%20int)`.
  ` final int` ` https://developer.android.com/reference/android/app/Fragment#getTargetRequestCode()() `

  Return the target request code set by `https://developer.android.com/reference/android/app/Fragment#setTargetFragment(android.app.Fragment,%20int)`.
  ` final https://developer.android.com/reference/java/lang/CharSequence` ` https://developer.android.com/reference/android/app/Fragment#getText(int)(int resId) `

  Return a localized, styled CharSequence from the application's package's default string table.
  ` boolean` ` https://developer.android.com/reference/android/app/Fragment#getUserVisibleHint()() ` ` https://developer.android.com/reference/android/view/View` ` https://developer.android.com/reference/android/app/Fragment#getView()() `

  Get the root view for the fragment's layout (the one returned by `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)`), if provided.
  ` final int` ` https://developer.android.com/reference/android/app/Fragment#hashCode()() `

  Subclasses can not override hashCode().
  ` static https://developer.android.com/reference/android/app/Fragment` ` https://developer.android.com/reference/android/app/Fragment#instantiate(android.content.Context,%20java.lang.String)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/java/lang/String fname) `

  Like `https://developer.android.com/reference/android/app/Fragment#instantiate(android.content.Context,%20java.lang.String,%20android.os.Bundle)` but with a null argument Bundle.
  ` static https://developer.android.com/reference/android/app/Fragment` ` https://developer.android.com/reference/android/app/Fragment#instantiate(android.content.Context,%20java.lang.String,%20android.os.Bundle)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/java/lang/String fname, https://developer.android.com/reference/android/os/Bundle args) `

  Create a new instance of a Fragment with the given class name.
  ` final boolean` ` https://developer.android.com/reference/android/app/Fragment#isAdded()() `

  Return true if the fragment is currently added to its activity.
  ` final boolean` ` https://developer.android.com/reference/android/app/Fragment#isDetached()() `

  Return true if the fragment has been explicitly detached from the UI.
  ` final boolean` ` https://developer.android.com/reference/android/app/Fragment#isHidden()() `

  Return true if the fragment has been hidden.
  ` final boolean` ` https://developer.android.com/reference/android/app/Fragment#isInLayout()() `

  Return true if the layout is included as part of an activity view hierarchy via the \<fragment\> tag.
  ` final boolean` ` https://developer.android.com/reference/android/app/Fragment#isRemoving()() `

  Return true if this fragment is currently being removed from its activity.
  ` final boolean` ` https://developer.android.com/reference/android/app/Fragment#isResumed()() `

  Return true if the fragment is in the resumed state.
  ` final boolean` ` https://developer.android.com/reference/android/app/Fragment#isStateSaved()() `

  Returns true if this fragment is added and its state has already been saved by its host.
  ` final boolean` ` https://developer.android.com/reference/android/app/Fragment#isVisible()() `

  Return true if the fragment is currently visible to the user.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onActivityCreated(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState) `

  Called when the fragment's activity has been created and this fragment's view hierarchy instantiated.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onActivityResult(int,%20int,%20android.content.Intent)(int requestCode, int resultCode, https://developer.android.com/reference/android/content/Intent data) `

  Receive the result from a previous call to `https://developer.android.com/reference/android/app/Fragment#startActivityForResult(android.content.Intent,%20int)`.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onAttach(android.app.Activity)(https://developer.android.com/reference/android/app/Activity activity) `

  *This method was deprecated in API level 23. Use `https://developer.android.com/reference/android/app/Fragment#onAttach(android.content.Context)` instead.*
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onAttach(android.content.Context)(https://developer.android.com/reference/android/content/Context context) `

  Called when a fragment is first attached to its context.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onAttachFragment(android.app.Fragment)(https://developer.android.com/reference/android/app/Fragment childFragment) `

  Called when a fragment is attached as a child of this fragment.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onConfigurationChanged(android.content.res.Configuration)(https://developer.android.com/reference/android/content/res/Configuration newConfig) `

  Called by the system when the device configuration changes while your component is running. If you override this method you *must* call through to the superclass implementation.
  ` boolean` ` https://developer.android.com/reference/android/app/Fragment#onContextItemSelected(android.view.MenuItem)(https://developer.android.com/reference/android/view/MenuItem item) `

  This hook is called whenever an item in a context menu is selected.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onCreate(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState) `

  Called to do initial creation of a fragment.
  ` https://developer.android.com/reference/android/animation/Animator` ` https://developer.android.com/reference/android/app/Fragment#onCreateAnimator(int,%20boolean,%20int)(int transit, boolean enter, int nextAnim) `

  Called when a fragment loads an animation.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onCreateContextMenu(android.view.ContextMenu,%20android.view.View,%20android.view.ContextMenu.ContextMenuInfo)(https://developer.android.com/reference/android/view/ContextMenu menu, https://developer.android.com/reference/android/view/View v, https://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo menuInfo) `

  Called when a context menu for the `view` is about to be shown.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onCreateOptionsMenu(android.view.Menu,%20android.view.MenuInflater)(https://developer.android.com/reference/android/view/Menu menu, https://developer.android.com/reference/android/view/MenuInflater inflater) `

  Initialize the contents of the Activity's standard options menu.
  ` https://developer.android.com/reference/android/view/View` ` https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)(https://developer.android.com/reference/android/view/LayoutInflater inflater, https://developer.android.com/reference/android/view/ViewGroup container, https://developer.android.com/reference/android/os/Bundle savedInstanceState) `

  Called to have the fragment instantiate its user interface view.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onDestroy()() `

  Called when the fragment is no longer in use.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onDestroyOptionsMenu()() `

  Called when this fragment's option menu items are no longer being included in the overall options menu.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onDestroyView()() `

  Called when the view previously created by `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)` has been detached from the fragment.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onDetach()() `

  Called when the fragment is no longer attached to its activity.
  ` https://developer.android.com/reference/android/view/LayoutInflater` ` https://developer.android.com/reference/android/app/Fragment#onGetLayoutInflater(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState) `

  Returns the LayoutInflater used to inflate Views of this Fragment.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onHiddenChanged(boolean)(boolean hidden) `

  Called when the hidden state (as returned by `https://developer.android.com/reference/android/app/Fragment#isHidden()` of the fragment has changed.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onInflate(android.util.AttributeSet,%20android.os.Bundle)(https://developer.android.com/reference/android/util/AttributeSet attrs, https://developer.android.com/reference/android/os/Bundle savedInstanceState) `

  *This method was deprecated in API level 15. Use `https://developer.android.com/reference/android/app/Fragment#onInflate(android.content.Context,%20android.util.AttributeSet,%20android.os.Bundle)` instead.*
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onInflate(android.app.Activity,%20android.util.AttributeSet,%20android.os.Bundle)(https://developer.android.com/reference/android/app/Activity activity, https://developer.android.com/reference/android/util/AttributeSet attrs, https://developer.android.com/reference/android/os/Bundle savedInstanceState) `

  *This method was deprecated in API level 23. Use `https://developer.android.com/reference/android/app/Fragment#onInflate(android.content.Context,%20android.util.AttributeSet,%20android.os.Bundle)` instead.*
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onInflate(android.content.Context,%20android.util.AttributeSet,%20android.os.Bundle)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/android/util/AttributeSet attrs, https://developer.android.com/reference/android/os/Bundle savedInstanceState) `

  Called when a fragment is being created as part of a view layout inflation, typically from setting the content view of an activity.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onLowMemory()() `

  This is called when the overall system is running low on memory, and actively running processes should trim their memory usage. If you override this method you *must* call through to the superclass implementation.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onMultiWindowModeChanged(boolean)(boolean isInMultiWindowMode) `

  *This method was deprecated in API level 26. Use `https://developer.android.com/reference/android/app/Fragment#onMultiWindowModeChanged(boolean,%20android.content.res.Configuration)` instead.*
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onMultiWindowModeChanged(boolean,%20android.content.res.Configuration)(boolean isInMultiWindowMode, https://developer.android.com/reference/android/content/res/Configuration newConfig) `

  Called when the Fragment's activity changes from fullscreen mode to multi-window mode and visa-versa.
  ` boolean` ` https://developer.android.com/reference/android/app/Fragment#onOptionsItemSelected(android.view.MenuItem)(https://developer.android.com/reference/android/view/MenuItem item) `

  This hook is called whenever an item in your options menu is selected.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onOptionsMenuClosed(android.view.Menu)(https://developer.android.com/reference/android/view/Menu menu) `

  This hook is called whenever the options menu is being closed (either by the user canceling the menu with the back/menu button, or when an item is selected).
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onPause()() `

  Called when the Fragment is no longer resumed.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onPictureInPictureModeChanged(boolean,%20android.content.res.Configuration)(boolean isInPictureInPictureMode, https://developer.android.com/reference/android/content/res/Configuration newConfig) `

  Called by the system when the activity changes to and from picture-in-picture mode.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onPictureInPictureModeChanged(boolean)(boolean isInPictureInPictureMode) `

  *This method was deprecated in API level 26. Use `https://developer.android.com/reference/android/app/Fragment#onPictureInPictureModeChanged(boolean,%20android.content.res.Configuration)` instead.*
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onPrepareOptionsMenu(android.view.Menu)(https://developer.android.com/reference/android/view/Menu menu) `

  Prepare the Screen's standard options menu to be displayed.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onRequestPermissionsResult(int,%20java.lang.String[],%20int[])(int requestCode, https://developer.android.com/reference/java/lang/String permissions, int[] grantResults) `

  Callback for the result from requesting permissions.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onResume()() `

  Called when the fragment is visible to the user and actively running.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onSaveInstanceState(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle outState) `

  Called to ask the fragment to save its current dynamic state, so it can later be reconstructed in a new instance of its process is restarted.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onStart()() `

  Called when the Fragment is visible to the user.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onStop()() `

  Called when the Fragment is no longer started.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onTrimMemory(int)(int level) `

  Called when the operating system has determined that it is a good time for a process to trim unneeded memory from its process. If you override this method you *must* call through to the superclass implementation.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onViewCreated(android.view.View,%20android.os.Bundle)(https://developer.android.com/reference/android/view/View view, https://developer.android.com/reference/android/os/Bundle savedInstanceState) `

  Called immediately after `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)` has returned, but before any saved state has been restored in to the view.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#onViewStateRestored(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle savedInstanceState) `

  Called when all saved state has been restored into the view hierarchy of the fragment.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#postponeEnterTransition()() `

  Postpone the entering Fragment transition until `https://developer.android.com/reference/android/app/Fragment#startPostponedEnterTransition()` or `https://developer.android.com/reference/android/app/FragmentManager#executePendingTransactions()` has been called.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#registerForContextMenu(android.view.View)(https://developer.android.com/reference/android/view/View view) `

  Registers a context menu to be shown for the given view (multiple views can show the context menu).
  ` final void` ` https://developer.android.com/reference/android/app/Fragment#requestPermissions(java.lang.String[],%20int)(https://developer.android.com/reference/java/lang/String permissions, int requestCode) `

  Requests permissions to be granted to this application.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#setAllowEnterTransitionOverlap(boolean)(boolean allow) `

  Sets whether the exit transition and enter transition overlap or not.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#setAllowReturnTransitionOverlap(boolean)(boolean allow) `

  Sets whether the return transition and reenter transition overlap or not.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#setArguments(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle args) `

  Supply the construction arguments for this fragment.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#setEnterSharedElementCallback(android.app.SharedElementCallback)(https://developer.android.com/reference/android/app/SharedElementCallback callback) `

  When custom transitions are used with Fragments, the enter transition callback is called when this Fragment is attached or detached when not popping the back stack.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#setEnterTransition(android.transition.Transition)(https://developer.android.com/reference/android/transition/Transition transition) `

  Sets the Transition that will be used to move Views into the initial scene.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#setExitSharedElementCallback(android.app.SharedElementCallback)(https://developer.android.com/reference/android/app/SharedElementCallback callback) `

  When custom transitions are used with Fragments, the exit transition callback is called when this Fragment is attached or detached when popping the back stack.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#setExitTransition(android.transition.Transition)(https://developer.android.com/reference/android/transition/Transition transition) `

  Sets the Transition that will be used to move Views out of the scene when the fragment is removed, hidden, or detached when not popping the back stack.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#setHasOptionsMenu(boolean)(boolean hasMenu) `

  Report that this fragment would like to participate in populating the options menu by receiving a call to `https://developer.android.com/reference/android/app/Fragment#onCreateOptionsMenu(android.view.Menu,%20android.view.MenuInflater)` and related methods.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#setInitialSavedState(android.app.Fragment.SavedState)(https://developer.android.com/reference/android/app/Fragment.SavedState state) `

  Set the initial saved state that this Fragment should restore itself from when first being constructed, as returned by `https://developer.android.com/reference/android/app/FragmentManager#saveFragmentInstanceState(android.app.Fragment)`.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#setMenuVisibility(boolean)(boolean menuVisible) `

  Set a hint for whether this fragment's menu should be visible.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#setReenterTransition(android.transition.Transition)(https://developer.android.com/reference/android/transition/Transition transition) `

  Sets the Transition that will be used to move Views in to the scene when returning due to popping a back stack.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#setRetainInstance(boolean)(boolean retain) `

  Control whether a fragment instance is retained across Activity re-creation (such as from a configuration change).
  ` void` ` https://developer.android.com/reference/android/app/Fragment#setReturnTransition(android.transition.Transition)(https://developer.android.com/reference/android/transition/Transition transition) `

  Sets the Transition that will be used to move Views out of the scene when the Fragment is preparing to be removed, hidden, or detached because of popping the back stack.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#setSharedElementEnterTransition(android.transition.Transition)(https://developer.android.com/reference/android/transition/Transition transition) `

  Sets the Transition that will be used for shared elements transferred into the content Scene.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#setSharedElementReturnTransition(android.transition.Transition)(https://developer.android.com/reference/android/transition/Transition transition) `

  Sets the Transition that will be used for shared elements transferred back during a pop of the back stack.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#setTargetFragment(android.app.Fragment,%20int)(https://developer.android.com/reference/android/app/Fragment fragment, int requestCode) `

  Optional target for this fragment.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#setUserVisibleHint(boolean)(boolean isVisibleToUser) `

  Set a hint to the system about whether this fragment's UI is currently visible to the user.
  ` boolean` ` https://developer.android.com/reference/android/app/Fragment#shouldShowRequestPermissionRationale(java.lang.String)(https://developer.android.com/reference/java/lang/String permission) `

  Gets whether you should show UI with rationale before requesting a permission.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#startActivity(android.content.Intent)(https://developer.android.com/reference/android/content/Intent intent) `

  Call `https://developer.android.com/reference/android/app/Activity#startActivity(android.content.Intent)` from the fragment's containing Activity.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#startActivity(android.content.Intent,%20android.os.Bundle)(https://developer.android.com/reference/android/content/Intent intent, https://developer.android.com/reference/android/os/Bundle options) `

  Call `https://developer.android.com/reference/android/app/Activity#startActivity(android.content.Intent,%20android.os.Bundle)` from the fragment's containing Activity.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#startActivityForResult(android.content.Intent,%20int)(https://developer.android.com/reference/android/content/Intent intent, int requestCode) `

  Call `https://developer.android.com/reference/android/app/Activity#startActivityForResult(android.content.Intent,%20int)` from the fragment's containing Activity.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#startActivityForResult(android.content.Intent,%20int,%20android.os.Bundle)(https://developer.android.com/reference/android/content/Intent intent, int requestCode, https://developer.android.com/reference/android/os/Bundle options) `

  Call `https://developer.android.com/reference/android/app/Activity#startActivityForResult(android.content.Intent,%20int,%20android.os.Bundle)` from the fragment's containing Activity.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#startIntentSenderForResult(android.content.IntentSender,%20int,%20android.content.Intent,%20int,%20int,%20int,%20android.os.Bundle)(https://developer.android.com/reference/android/content/IntentSender intent, int requestCode, https://developer.android.com/reference/android/content/Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, https://developer.android.com/reference/android/os/Bundle options) `

  Call `https://developer.android.com/reference/android/app/Activity#startIntentSenderForResult(android.content.IntentSender,%20int,%20android.content.Intent,%20int,%20int,%20int,%20android.os.Bundle)` from the fragment's containing Activity.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#startPostponedEnterTransition()() `

  Begin postponed transitions after `https://developer.android.com/reference/android/app/Fragment#postponeEnterTransition()` was called.
  ` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/android/app/Fragment#toString()() `

  Returns a string representation of the object.
  ` void` ` https://developer.android.com/reference/android/app/Fragment#unregisterForContextMenu(android.view.View)(https://developer.android.com/reference/android/view/View view) `

  Prevents a context menu to be shown for the given view.
  From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

  Creates and returns a copy of this object.
  ` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

  Indicates whether some other object is "equal to" this one.
  ` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

  Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
  ` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

  Returns the runtime class of this `Object`.
  ` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

  Returns a hash code value for the object.
  ` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

  Wakes up a single thread that is waiting on this object's monitor.
  ` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

  Wakes up all threads that are waiting on this object's monitor.
  ` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

  Returns a string representation of the object.
  ` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

  Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
  ` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

  Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
  ` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

  Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
  From interface ` https://developer.android.com/reference/android/content/ComponentCallbacks2 ` ` abstract void` ` https://developer.android.com/reference/android/content/ComponentCallbacks2#onTrimMemory(int)(int level) `

  Called when the operating system has determined that it is a good time for a process to trim unneeded memory from its process.
  From interface ` https://developer.android.com/reference/android/view/View.OnCreateContextMenuListener ` ` abstract void` ` https://developer.android.com/reference/android/view/View.OnCreateContextMenuListener#onCreateContextMenu(android.view.ContextMenu,%20android.view.View,%20android.view.ContextMenu.ContextMenuInfo)(https://developer.android.com/reference/android/view/ContextMenu menu, https://developer.android.com/reference/android/view/View v, https://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo menuInfo) `

  Called when the context menu for this view is being built.
  From interface ` https://developer.android.com/reference/android/content/ComponentCallbacks ` ` abstract void` ` https://developer.android.com/reference/android/content/ComponentCallbacks#onConfigurationChanged(android.content.res.Configuration)(https://developer.android.com/reference/android/content/res/Configuration newConfig) `

  Called by the system when the device configuration changes while your component is running.
  ` abstract void` ` https://developer.android.com/reference/android/content/ComponentCallbacks#onLowMemory()() `

  *This method was deprecated in API level 35. Since API level 14 this is superseded by `https://developer.android.com/reference/android/content/ComponentCallbacks2#onTrimMemory(int)`. Since API level 34 this is never called. If you're overriding ComponentCallbacks2#onTrimMemory and your minSdkVersion is greater than API 14, you can provide an empty implementation for this method.*

  ## Public constructors

  ### PreferenceFragment

  ```
  public PreferenceFragment ()
  ```

  <br />

  <br />

  ## Public methods

  ### addPreferencesFromIntent

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

  ```
  public void addPreferencesFromIntent (Intent intent)
  ```

  Adds preferences from activities that match the given `https://developer.android.com/reference/android/content/Intent`.

  <br />

  | Parameters ||
  |---|---|
  | `intent` | `Intent`: The `https://developer.android.com/reference/android/content/Intent` to query activities. <br /> |

  ### addPreferencesFromResource

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

  ```
  public 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 [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

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

  Finds a `https://developer.android.com/reference/android/preference/Preference` based on its key.

  <br />

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

  | Returns ||
  |---|---|
  | `https://developer.android.com/reference/android/preference/Preference` | The `https://developer.android.com/reference/android/preference/Preference` with the key, or null. <br /> |

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

  ### getPreferenceManager

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

  ```
  public PreferenceManager getPreferenceManager ()
  ```

  Returns the `https://developer.android.com/reference/android/preference/PreferenceManager` used by this fragment.

  <br />

  | Returns ||
  |---|---|
  | `https://developer.android.com/reference/android/preference/PreferenceManager` | The `https://developer.android.com/reference/android/preference/PreferenceManager`. <br /> |

  ### getPreferenceScreen

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

  ```
  public PreferenceScreen getPreferenceScreen ()
  ```

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

  <br />

  | Returns ||
  |---|---|
  | `https://developer.android.com/reference/android/preference/PreferenceScreen` | The `https://developer.android.com/reference/android/preference/PreferenceScreen` that is the root of the preference hierarchy. <br /> |

  ### onActivityCreated

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

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

  Called when the fragment's activity has been created and this fragment's view hierarchy instantiated. It can be used to do final initialization once these pieces are in place, such as retrieving views or restoring state. It is also useful for fragments that use `https://developer.android.com/reference/android/app/Fragment#setRetainInstance(boolean)` to retain their instance, as this callback tells the fragment when it is fully associated with the new activity instance. This is called after `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)` and before `https://developer.android.com/reference/android/app/Fragment#onViewStateRestored(android.os.Bundle)`.   

  If you override this method you *must* call through to the superclass implementation.

  <br />

  | Parameters ||
  |---|---|
  | `savedInstanceState` | `Bundle`: This value may be `null`. <br /> |

  ### onActivityResult

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

  ```
  public void onActivityResult (int requestCode, 
                  int resultCode, 
                  Intent data)
  ```

  Receive the result from a previous call to `https://developer.android.com/reference/android/app/Fragment#startActivityForResult(android.content.Intent,%20int)`. This follows the related Activity API as described there in `https://developer.android.com/reference/android/app/Activity#onActivityResult(int,%20int,%20android.content.Intent)`.

  <br />

  | Parameters ||
  |---|---|
  | `requestCode` | `int`: The integer request code originally supplied to startActivityForResult(), allowing you to identify who this result came from. <br /> |
  | `resultCode` | `int`: The integer result code returned by the child activity through its setResult(). <br /> |
  | `data` | `Intent`: An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). <br /> |

  ### onCreate

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

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

  Called to do initial creation of a fragment. This is called after `https://developer.android.com/reference/android/app/Fragment#onAttach(android.app.Activity)` and before `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)`, but is not called if the fragment instance is retained across Activity re-creation (see `https://developer.android.com/reference/android/app/Fragment#setRetainInstance(boolean)`).

  Note that this can be called while the fragment's activity is still in the process of being created. As such, you can not rely on things like the activity's content view hierarchy being initialized at this point. If you want to do work once the activity itself is created, see `https://developer.android.com/reference/android/app/Fragment#onActivityCreated(android.os.Bundle)`.

  If your app's `targetSdkVersion` is `https://developer.android.com/reference/android/os/Build.VERSION_CODES#M` or lower, child fragments being restored from the savedInstanceState are restored after `onCreate` returns. When targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES#N` or above and running on an N or newer platform version they are restored by `Fragment.onCreate`.
  .   
  If you override this method you *must* call through to the superclass implementation.

  <br />

  <br />

  | Parameters ||
  |---|---|
  | `savedInstanceState` | `Bundle`: This value may be `null`. <br /> |

  ### onCreateView

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

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

  Called to have the fragment instantiate its user interface view. This is optional, and non-graphical fragments can return null (which is the default implementation). This will be called between `https://developer.android.com/reference/android/app/Fragment#onCreate(android.os.Bundle)` and `https://developer.android.com/reference/android/app/Fragment#onActivityCreated(android.os.Bundle)`.

  If you return a View from here, you will later be called in `https://developer.android.com/reference/android/app/Fragment#onDestroyView()` when the view is being released.

  <br />

  | Parameters ||
  |---|---|
  | `inflater` | `LayoutInflater`: The LayoutInflater object that can be used to inflate any views in the fragment, <br /> |
  | `container` | `ViewGroup`: This value may be `null`. <br /> |
  | `savedInstanceState` | `Bundle`: This value may be `null`. <br /> |

  | Returns ||
  |---|---|
  | `https://developer.android.com/reference/android/view/View` | Return the View for the fragment's UI, or null. <br /> |

  ### onDestroy

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

  ```
  public void onDestroy ()
  ```

  Called when the fragment is no longer in use. This is called after `https://developer.android.com/reference/android/app/Fragment#onStop()` and before `https://developer.android.com/reference/android/app/Fragment#onDetach()`.   

  If you override this method you *must* call through to the superclass implementation.

  <br />

  ### onDestroyView

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

  ```
  public void onDestroyView ()
  ```

  Called when the view previously created by `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)` has been detached from the fragment. The next time the fragment needs to be displayed, a new view will be created. This is called after `https://developer.android.com/reference/android/app/Fragment#onStop()` and before `https://developer.android.com/reference/android/app/Fragment#onDestroy()`. It is called *regardless* of whether `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)` returned a non-null view. Internally it is called after the view's state has been saved but before it has been removed from its parent.   

  If you override this method you *must* call through to the superclass implementation.

  <br />

  ### onPreferenceTreeClick

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

  ```
  public boolean onPreferenceTreeClick (PreferenceScreen preferenceScreen, 
                  Preference preference)
  ```

  <br />

  <br />

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

  | Returns ||
  |---|---|
  | `boolean` | <br /> |

  ### onSaveInstanceState

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

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

  Called to ask the fragment to save its current dynamic state, so it can later be reconstructed in a new instance of its process is restarted. If a new instance of the fragment later needs to be created, the data you place in the Bundle here will be available in the Bundle given to `https://developer.android.com/reference/android/app/Fragment#onCreate(android.os.Bundle)`, `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)`, and `https://developer.android.com/reference/android/app/Fragment#onActivityCreated(android.os.Bundle)`.

  This corresponds to `https://developer.android.com/reference/android/app/Activity#onSaveInstanceState(android.os.Bundle)` and most of the discussion there applies here as well. Note however: *this method may be called at any time before `https://developer.android.com/reference/android/app/Fragment#onDestroy()`*. There are many situations where a fragment may be mostly torn down (such as when placed on the back stack with no UI showing), but its state will not be saved until its owning activity actually needs to save its state.

  <br />

  | Parameters ||
  |---|---|
  | `outState` | `Bundle`: Bundle in which to place your saved state. <br /> |

  ### onStart

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

  ```
  public void onStart ()
  ```

  Called when the Fragment is visible to the user. This is generally tied to `https://developer.android.com/reference/android/app/Activity#onStart()` of the containing Activity's lifecycle.   

  If you override this method you *must* call through to the superclass implementation.

  <br />

  ### onStop

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

  ```
  public void onStop ()
  ```

  Called when the Fragment is no longer started. This is generally tied to `https://developer.android.com/reference/android/app/Activity#onStop()` of the containing Activity's lifecycle.   

  If you override this method you *must* call through to the superclass implementation.

  <br />

  ### onViewCreated

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

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

  Called immediately after `https://developer.android.com/reference/android/app/Fragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)` has returned, but before any saved state has been restored in to the view. This gives subclasses a chance to initialize themselves once they know their view hierarchy has been completely created. The fragment's view hierarchy is not however attached to its parent at this point.

  <br />

  | Parameters ||
  |---|---|
  | `view` | `View`: The View returned by `https://developer.android.com/reference/android/preference/PreferenceFragment#onCreateView(android.view.LayoutInflater,%20android.view.ViewGroup,%20android.os.Bundle)`. <br /> |
  | `savedInstanceState` | `Bundle`: This value may be `null`. <br /> |

  ### setPreferenceScreen

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

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

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

  <br />

  | Parameters ||
  |---|---|
  | `preferenceScreen` | `PreferenceScreen`: The root `https://developer.android.com/reference/android/preference/PreferenceScreen` of the preference hierarchy. <br /> |