The Android Developer Challenge is back! Submit your idea before December 2.

LeanbackSettingsFragmentCompat

abstract class LeanbackSettingsFragmentCompat : Fragment, PreferenceFragmentCompat.OnPreferenceStartFragmentCallback, PreferenceFragmentCompat.OnPreferenceStartScreenCallback, PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback
kotlin.Any
   ↳ androidx.fragment.app.Fragment
   ↳ androidx.leanback.preference.LeanbackSettingsFragmentCompat

This fragment provides a container for displaying a LeanbackPreferenceFragmentCompat

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

The sample implements PreferenceFragmentCompat.OnPreferenceStartFragmentCallback#onPreferenceStartFragment( * PreferenceFragmentCompat, Preference), PreferenceFragmentCompat.OnPreferenceStartScreenCallback#onPreferenceStartScreen( * PreferenceFragmentCompat, PreferenceScreen), and onPreferenceStartInitialScreen():

Summary

Public constructors

This fragment provides a container for displaying a LeanbackPreferenceFragmentCompat

Public methods

open View?
onCreateView(@NonNull inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?)

open Unit

open Boolean

abstract Unit

Called to instantiate the initial PreferenceFragment to be shown in this fragment.

open Unit

open Unit
onViewCreated(@NonNull view: View, savedInstanceState: Bundle?)

open Unit
startImmersiveFragment(@NonNull fragment: Fragment)

Displays a fragment to the user, temporarily replacing the contents of this fragment.

open Unit
startPreferenceFragment(@NonNull fragment: Fragment)

Displays a preference fragment to the user.

Inherited functions

Public constructors

<init>

LeanbackSettingsFragmentCompat()

This fragment provides a container for displaying a LeanbackPreferenceFragmentCompat

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

The sample implements PreferenceFragmentCompat.OnPreferenceStartFragmentCallback#onPreferenceStartFragment( * PreferenceFragmentCompat, Preference), PreferenceFragmentCompat.OnPreferenceStartScreenCallback#onPreferenceStartScreen( * PreferenceFragmentCompat, PreferenceScreen), and onPreferenceStartInitialScreen():

Public methods

onCreateView

open fun onCreateView(@NonNull inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View?

onPause

open fun onPause(): Unit

onPreferenceDisplayDialog

open fun onPreferenceDisplayDialog(@NonNull caller: PreferenceFragmentCompat, pref: Preference!): Boolean

onPreferenceStartInitialScreen

abstract fun onPreferenceStartInitialScreen(): Unit

Called to instantiate the initial PreferenceFragment to be shown in this fragment. Implementations are expected to call startPreferenceFragment(Fragment).

onResume

open fun onResume(): Unit

onViewCreated

open fun onViewCreated(@NonNull view: View, savedInstanceState: Bundle?): Unit

startImmersiveFragment

open fun startImmersiveFragment(@NonNull fragment: Fragment): Unit

Displays a fragment to the user, temporarily replacing the contents of this fragment.

Parameters
fragment Fragment: Fragment instance to be added.

startPreferenceFragment

open fun startPreferenceFragment(@NonNull fragment: Fragment): Unit

Displays a preference fragment to the user. This method can also be used to display list-style fragments on top of the stack of preference fragments.

Parameters
fragment Fragment: Fragment instance to be added.