Skip to content

Most visited

Recently visited

navigation

ListPreferenceDialogFragment

public class ListPreferenceDialogFragment
extends PreferenceDialogFragment

java.lang.Object
   ↳ android.app.Fragment
     ↳ android.app.DialogFragment
       ↳ android.support.v14.preference.PreferenceDialogFragment
         ↳ android.support.v14.preference.ListPreferenceDialogFragment


Summary

Inherited XML attributes

From class android.app.Fragment

Inherited constants

From class android.support.v14.preference.PreferenceDialogFragment
From class android.app.DialogFragment
From interface android.content.ComponentCallbacks2

Public constructors

ListPreferenceDialogFragment()

Public methods

static ListPreferenceDialogFragment 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

From class android.support.v14.preference.PreferenceDialogFragment
From class android.app.DialogFragment
From class android.app.Fragment
From class java.lang.Object
From interface android.content.DialogInterface.OnClickListener
From interface android.content.DialogInterface.OnCancelListener
From interface android.content.DialogInterface.OnDismissListener
From interface android.content.ComponentCallbacks2
From interface android.view.View.OnCreateContextMenuListener
From interface android.content.ComponentCallbacks

Public constructors

ListPreferenceDialogFragment

added in version 23.0.0
ListPreferenceDialogFragment ()

Public methods

newInstance

added in version 23.0.0
ListPreferenceDialogFragment newInstance (String key)

Parameters
key String

Returns
ListPreferenceDialogFragment

onCreate

void onCreate (Bundle savedInstanceState)

Called to do initial creation of a fragment. This is called after onAttach(Activity) and before onCreateView(LayoutInflater, ViewGroup, Bundle), but is not called if the fragment instance is retained across Activity re-creation (see 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 onActivityCreated(Bundle).

If your app's targetSdkVersion is M or lower, child fragments being restored from the savedInstanceState are restored after onCreate returns. When targeting N or above and running on an N or newer platform version they are restored by Fragment.onCreate.

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

onDialogClosed

added in version 23.0.0
void onDialogClosed (boolean positiveResult)

Parameters
positiveResult boolean

onSaveInstanceState

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

added in version 23.0.0
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 create() or show().

Parameters
builder AlertDialog.Builder

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)