Register now for Android Dev Summit 2019!

LeanbackSettingsFragment

abstract class LeanbackSettingsFragment : Fragment, PreferenceFragment.OnPreferenceStartFragmentCallback, PreferenceFragment.OnPreferenceStartScreenCallback, PreferenceFragment.OnPreferenceDisplayDialogCallback
kotlin.Any
   ↳ android.app.Fragment
   ↳ androidx.leanback.preference.LeanbackSettingsFragment

This fragment provides a container for displaying a LeanbackPreferenceFragment

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

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

Summary

Public constructors

This fragment provides a container for displaying a LeanbackPreferenceFragment

Public methods

open View!
onCreateView(inflater: LayoutInflater!, container: ViewGroup!, savedInstanceState: Bundle!)

open Unit

open Boolean

abstract Unit

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

open Unit

open Unit
onViewCreated(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>

LeanbackSettingsFragment()

Deprecated: Use LeanbackSettingsFragmentCompat

This fragment provides a container for displaying a LeanbackPreferenceFragment

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

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

Public methods

onCreateView

open fun onCreateView(inflater: LayoutInflater!, container: ViewGroup!, savedInstanceState: Bundle!): View!

onPause

open fun onPause(): Unit

onPreferenceDisplayDialog

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

onPreferenceStartInitialScreen

abstract fun onPreferenceStartInitialScreen(): Unit

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

onResume

open fun onResume(): Unit

onViewCreated

open fun onViewCreated(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.