PreferenceDialogFragmentCompat

public abstract class PreferenceDialogFragmentCompat
extends DialogFragment implements DialogInterface.OnClickListener

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


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

Inherited constants

Public constructors

PreferenceDialogFragmentCompat()

Public methods

DialogPreference getPreference()

Get the preference that requested this dialog.

void onClick(DialogInterface dialog, int which)
void onCreate(Bundle savedInstanceState)

Called to do initial creation of a fragment.

Dialog onCreateDialog(Bundle savedInstanceState)

Override to build your own custom Dialog container.

abstract void onDialogClosed(boolean positiveResult)
void onDismiss(DialogInterface dialog)
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 if its process is restarted.

Protected methods

void onBindDialogView(View view)

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

View onCreateDialogView(Context context)

Creates the content view for the dialog (if a custom content view is required).

void onPrepareDialogBuilder(AlertDialog.Builder builder)

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

Inherited methods