PreferenceDialogFragment

public abstract class PreferenceDialogFragment
extends DialogFragment implements DialogInterface.OnClickListener

java.lang.Object
   ↳ android.app.Fragment
     ↳ android.app.DialogFragment
       ↳ androidx.preference.PreferenceDialogFragment


This class is deprecated.
Use PreferenceDialogFragmentCompat instead

Abstract base class which presents a dialog associated with a DialogPreference. Since the preference object may not be available during fragment re-creation, the necessary information for displaying the dialog is read once during the initial call to onCreate(Bundle) and saved/restored in the saved instance state. Custom subclasses should also follow this pattern.

Summary

Constants

String ARG_KEY

This constant is deprecated. Use PreferenceDialogFragmentCompat instead

Inherited constants

Public constructors

PreferenceDialogFragment()

This constructor is deprecated. Use PreferenceDialogFragmentCompat instead

Public methods

DialogPreference getPreference()

This method is deprecated. Use PreferenceDialogFragmentCompat instead

void onClick(DialogInterface dialog, int which)

This method is deprecated. Use PreferenceDialogFragmentCompat instead

void onCreate(Bundle savedInstanceState)
Dialog onCreateDialog(Bundle savedInstanceState)
abstract void onDialogClosed(boolean positiveResult)

This method is deprecated. Use PreferenceDialogFragmentCompat instead

void onDismiss(DialogInterface dialog)
void onSaveInstanceState(Bundle outState)

Protected methods

void onBindDialogView(View view)

This method is deprecated. Use PreferenceDialogFragmentCompat instead

View onCreateDialogView(Context context)

This method is deprecated. Use PreferenceDialogFragmentCompat instead

void onPrepareDialogBuilder(AlertDialog.Builder builder)

This method is deprecated. Use PreferenceDialogFragmentCompat instead

Inherited methods

Constants

ARG_KEY

protected static final String ARG_KEY

This constant is deprecated.
Use PreferenceDialogFragmentCompat instead

Constant Value: "key"

Public constructors

PreferenceDialogFragment

public PreferenceDialogFragment ()

This constructor is deprecated.
Use PreferenceDialogFragmentCompat instead

Public methods

getPreference

public DialogPreference getPreference ()

This method is deprecated.
Use PreferenceDialogFragmentCompat instead

Get the preference that requested this dialog. Available after onCreate(Bundle) has been called on the PreferenceFragment which launched this dialog.

Returns
DialogPreference The DialogPreference associated with this dialog

onClick

public void onClick (DialogInterface dialog, 
                int which)

This method is deprecated.
Use PreferenceDialogFragmentCompat instead

Parameters
dialog DialogInterface

which int

onCreate

public void onCreate (Bundle savedInstanceState)

Parameters
savedInstanceState Bundle

onCreateDialog

public Dialog onCreateDialog (Bundle savedInstanceState)

Parameters
savedInstanceState Bundle

Returns
Dialog

onDialogClosed

public abstract void onDialogClosed (boolean positiveResult)

This method is deprecated.
Use PreferenceDialogFragmentCompat instead

Parameters
positiveResult boolean

onDismiss

public void onDismiss (DialogInterface dialog)

Parameters
dialog DialogInterface

onSaveInstanceState

public void onSaveInstanceState (Bundle outState)

Parameters
outState Bundle

Protected methods

onBindDialogView

protected void onBindDialogView (View view)

This method is deprecated.
Use PreferenceDialogFragmentCompat instead

Binds views in the content view of the dialog to data.

Make sure to call through to the superclass implementation.

Parameters
view View: The content view of the dialog, if it is custom

onCreateDialogView

protected View onCreateDialogView (Context context)

This method is deprecated.
Use PreferenceDialogFragmentCompat instead

Creates the content view for the dialog (if a custom content view is required). By default, it inflates the dialog layout resource if it is set.

Parameters
context Context

Returns
View The content view for the dialog

onPrepareDialogBuilder

protected void onPrepareDialogBuilder (AlertDialog.Builder builder)

This method is deprecated.
Use PreferenceDialogFragmentCompat instead

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