It's happening now, watch the livestream.

LeanbackListPreferenceDialogFragmentCompat

public class LeanbackListPreferenceDialogFragmentCompat
extends LeanbackPreferenceDialogFragmentCompat

java.lang.Object
   ↳ androidx.fragment.app.Fragment
     ↳ androidx.leanback.preference.LeanbackPreferenceDialogFragmentCompat
       ↳ androidx.leanback.preference.LeanbackListPreferenceDialogFragmentCompat


Implemented a dialog to show ListPreference or MultiSelectListPreference.

Summary

Nested classes

class LeanbackListPreferenceDialogFragmentCompat.ViewHolder

ViewHolder for each Item in the List. 

Inherited constants

Public constructors

LeanbackListPreferenceDialogFragmentCompat()

Public methods

static LeanbackListPreferenceDialogFragmentCompat newInstanceMulti(String key)

Create a new LeanbackListPreferenceDialogFragmentCompat.

static LeanbackListPreferenceDialogFragmentCompat newInstanceSingle(String key)

Create a new LeanbackListPreferenceDialogFragmentCompat.

void onCreate(Bundle savedInstanceState)

Called to do initial creation of a fragment.

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

Called to have the fragment instantiate its user interface view.

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.

Inherited methods

Public constructors

LeanbackListPreferenceDialogFragmentCompat

public LeanbackListPreferenceDialogFragmentCompat ()

Public methods

newInstanceMulti

public static LeanbackListPreferenceDialogFragmentCompat newInstanceMulti (String key)

Create a new LeanbackListPreferenceDialogFragmentCompat.

Parameters
key String: The key of MultiSelectListPreference it will be created from.

Returns
LeanbackListPreferenceDialogFragmentCompat A new LeanbackListPreferenceDialogFragmentCompat to display.

newInstanceSingle

public static LeanbackListPreferenceDialogFragmentCompat newInstanceSingle (String key)

Create a new LeanbackListPreferenceDialogFragmentCompat.

Parameters
key String: The key of ListPreference it will be created from.

Returns
LeanbackListPreferenceDialogFragmentCompat A new LeanbackListPreferenceDialogFragmentCompat to display.

onCreate

public void onCreate (Bundle savedInstanceState)

Called to do initial creation of a fragment. This is called after onAttach(Activity) and before onCreateView(LayoutInflater, ViewGroup, Bundle).

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 onActivityCreated(Bundle).

Any restored child fragments will be created before the base Fragment.onCreate method returns.

Parameters
savedInstanceState Bundle: If the fragment is being re-created from a previous saved state, this is the state.

onCreateView

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. This will be called between onCreate(Bundle) and onActivityCreated(Bundle).

A default View can be returned by calling Fragment(int) in your constructor. Otherwise, this method returns null.

It is recommended to only inflate the layout in this method and move logic that operates on the returned View to onViewCreated(View, Bundle).

If you return a View from here, you will later be called in onDestroyView() when the view is being released.

Parameters
inflater LayoutInflater: The LayoutInflater object that can be used to inflate any views in the fragment,

container ViewGroup: If non-null, this is the parent view that the fragment's UI should be attached to. The fragment should not add the view itself, but this can be used to generate the LayoutParams of the view.

savedInstanceState Bundle: If non-null, this fragment is being re-constructed from a previous saved state as given here.

Returns
View Return the View for the fragment's UI, or null.

onSaveInstanceState

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 onCreate(Bundle), onCreateView(LayoutInflater, ViewGroup, Bundle), and onActivityCreated(Bundle).

This corresponds to Activity.onSaveInstanceState(Bundle) and most of the discussion there applies here as well. Note however: this method may be called at any time before 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.

Parameters
outState Bundle: Bundle in which to place your saved state.