lightbulb_outline Help shape the future of the Google Play Console, Android Studio, and Firebase. Start survey

belongs to Maven artifact androidx.preference:preference:1.0.0-alpha3

ListPreferenceDialogFragmentCompat

public class ListPreferenceDialogFragmentCompat
extends PreferenceDialogFragmentCompat

java.lang.Object
   ↳ androidx.fragment.app.Fragment
     ↳ androidx.fragment.app.DialogFragment
       ↳ androidx.preference.PreferenceDialogFragmentCompat
         ↳ androidx.preference.ListPreferenceDialogFragmentCompat


Summary

Inherited constants

Public constructors

ListPreferenceDialogFragmentCompat()

Public methods

static ListPreferenceDialogFragmentCompat newInstance(String key)
void onCreate(Bundle savedInstanceState)

Called to do initial creation of a fragment.

void onDialogClosed(boolean positiveResult)
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.

Protected methods

void onPrepareDialogBuilder(AlertDialog.Builder builder)

Prepares the dialog builder to be shown when the preference is clicked.

Inherited methods

Public constructors

ListPreferenceDialogFragmentCompat

public ListPreferenceDialogFragmentCompat ()

Public methods

newInstance

public static ListPreferenceDialogFragmentCompat newInstance (String key)

Parameters
key String

Returns
ListPreferenceDialogFragmentCompat

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.

onDialogClosed

public void onDialogClosed (boolean positiveResult)

Parameters
positiveResult boolean

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.

Protected methods

onPrepareDialogBuilder

protected void onPrepareDialogBuilder (AlertDialog.Builder builder)

Prepares the dialog builder to be shown when the preference is clicked. Use this to set custom properties on the dialog.

Do not AlertDialog.Builder.create() or AlertDialog.Builder.show().

Parameters
builder AlertDialog.Builder