public abstract class DialogPreference extends Preference
Preference
objects that are
dialog-based. These preferences will, when clicked, open a dialog showing the
actual preference controls.Modifier and Type | Class and Description |
---|---|
static interface |
DialogPreference.TargetFragment |
Preference.BaseSavedState, Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener
DEFAULT_ORDER
Constructor and Description |
---|
DialogPreference(Context context) |
DialogPreference(Context context,
AttributeSet attrs) |
DialogPreference(Context context,
AttributeSet attrs,
int defStyleAttr) |
DialogPreference(Context context,
AttributeSet attrs,
int defStyleAttr,
int defStyleRes) |
Modifier and Type | Method and Description |
---|---|
Drawable |
getDialogIcon()
Returns the icon to be shown on subsequent dialogs.
|
int |
getDialogLayoutResource()
Returns the layout resource that is used as the content View for
subsequent dialogs.
|
CharSequence |
getDialogMessage()
Returns the message to be shown on subsequent dialogs.
|
CharSequence |
getDialogTitle()
Returns the title to be shown on subsequent dialogs.
|
CharSequence |
getNegativeButtonText()
Returns the text of the negative button to be shown on subsequent
dialogs.
|
CharSequence |
getPositiveButtonText()
Returns the text of the positive button to be shown on subsequent
dialogs.
|
protected void |
onClick()
Processes a click on the preference.
|
void |
setDialogIcon(Drawable dialogIcon)
Sets the icon of the dialog.
|
void |
setDialogIcon(int dialogIconRes)
Sets the icon (resource ID) of the dialog.
|
void |
setDialogLayoutResource(int dialogLayoutResId)
Sets the layout resource that is inflated as the
View to be shown
as the content View of subsequent dialogs. |
void |
setDialogMessage(CharSequence dialogMessage)
Sets the message of the dialog.
|
void |
setDialogMessage(int dialogMessageResId) |
void |
setDialogTitle(CharSequence dialogTitle)
Sets the title of the dialog.
|
void |
setDialogTitle(int dialogTitleResId) |
void |
setNegativeButtonText(CharSequence negativeButtonText)
Sets the text of the negative button of the dialog.
|
void |
setNegativeButtonText(int negativeButtonTextResId) |
void |
setPositiveButtonText(CharSequence positiveButtonText)
Sets the text of the positive button of the dialog.
|
void |
setPositiveButtonText(int positiveButtonTextResId) |
callChangeListener, compareTo, findPreferenceInHierarchy, getContext, getDependency, getExtras, getFragment, getIcon, getIntent, getKey, getLayoutResource, getOnPreferenceChangeListener, getOnPreferenceClickListener, getOrder, getPersistedBoolean, getPersistedFloat, getPersistedInt, getPersistedLong, getPersistedString, getPreferenceManager, getSharedPreferences, getShouldDisableView, getSummary, getTitle, getWidgetLayoutResource, hasKey, isEnabled, isPersistent, isSelectable, isVisible, notifyChanged, notifyDependencyChange, notifyHierarchyChanged, onAttached, onAttachedToHierarchy, onAttachedToHierarchy, onBindViewHolder, onDependencyChanged, onDetached, onGetDefaultValue, onInitializeAccessibilityNodeInfo, onParentChanged, onPrepareForRemoval, onRestoreInstanceState, onSaveInstanceState, onSetInitialValue, peekExtras, performClick, performClick, persistBoolean, persistFloat, persistInt, persistLong, persistString, restoreHierarchyState, saveHierarchyState, setDefaultValue, setDependency, setEnabled, setFragment, setIcon, setIcon, setIntent, setKey, setLayoutResource, setOnPreferenceChangeListener, setOnPreferenceClickListener, setOrder, setPersistent, setSelectable, setShouldDisableView, setSummary, setSummary, setTitle, setTitle, setViewId, setVisible, setWidgetLayoutResource, shouldDisableDependents, shouldPersist, toString
public DialogPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
public DialogPreference(Context context, AttributeSet attrs, int defStyleAttr)
public DialogPreference(Context context, AttributeSet attrs)
public DialogPreference(Context context)
public void setDialogTitle(CharSequence dialogTitle)
dialogTitle
- The title.public void setDialogTitle(int dialogTitleResId)
dialogTitleResId
- The dialog title as a resource.setDialogTitle(CharSequence)
public CharSequence getDialogTitle()
public void setDialogMessage(CharSequence dialogMessage)
This message forms the content View of the dialog and conflicts with
list-based dialogs, for example. If setting a custom View on a dialog via
setDialogLayoutResource(int)
, include a text View with ID
android.R.id#message
and it will be populated with this message.
dialogMessage
- The message.public void setDialogMessage(int dialogMessageResId)
dialogMessageResId
- The dialog message as a resource.setDialogMessage(CharSequence)
public CharSequence getDialogMessage()
public void setDialogIcon(Drawable dialogIcon)
dialogIcon
- The icon, as a Drawable
.public void setDialogIcon(int dialogIconRes)
dialogIconRes
- The icon, as a resource ID.public Drawable getDialogIcon()
Drawable
.public void setPositiveButtonText(CharSequence positiveButtonText)
positiveButtonText
- The text of the positive button.public void setPositiveButtonText(int positiveButtonTextResId)
positiveButtonTextResId
- The positive button text as a resource.setPositiveButtonText(CharSequence)
public CharSequence getPositiveButtonText()
public void setNegativeButtonText(CharSequence negativeButtonText)
negativeButtonText
- The text of the negative button.public void setNegativeButtonText(int negativeButtonTextResId)
negativeButtonTextResId
- The negative button text as a resource.setNegativeButtonText(CharSequence)
public CharSequence getNegativeButtonText()
public void setDialogLayoutResource(int dialogLayoutResId)
View
to be shown
as the content View of subsequent dialogs.dialogLayoutResId
- The layout resource ID to be inflated.setDialogMessage(CharSequence)
public int getDialogLayoutResource()
protected void onClick()
Preference
SharedPreferences
. However, the overridden method should
call Preference.callChangeListener(Object)
to make sure the client wants to
update the preference's state with the new value.onClick
in class Preference