public
abstract
class
DialogPreference
extends Preference
| java.lang.Object | ||
| ↳ | android.support.v7.preference.Preference | |
| ↳ | android.support.v7.preference.DialogPreference | |
|
|
|
|
A base class for Preference objects that are
dialog-based. These preferences will, when clicked, open a dialog showing the
actual preference controls.
Nested classes | |
|---|---|
interface |
DialogPreference.TargetFragment
|
Inherited constants |
|---|
android.support.v7.preference.Preference
|
Public constructors | |
|---|---|
DialogPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
|
|
DialogPreference(Context context, AttributeSet attrs, int defStyleAttr)
|
|
DialogPreference(Context context, AttributeSet attrs)
|
|
DialogPreference(Context context)
|
|
Public methods | |
|---|---|
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. |
void
|
setDialogIcon(int dialogIconRes)
Sets the icon (resource ID) of the dialog. |
void
|
setDialogIcon(Drawable dialogIcon)
Sets the icon of the dialog. |
void
|
setDialogLayoutResource(int dialogLayoutResId)
Sets the layout resource that is inflated as the |
void
|
setDialogMessage(CharSequence dialogMessage)
Sets the message of the dialog. |
void
|
setDialogMessage(int dialogMessageResId)
|
void
|
setDialogTitle(int dialogTitleResId)
|
void
|
setDialogTitle(CharSequence dialogTitle)
Sets the title of the dialog. |
void
|
setNegativeButtonText(CharSequence negativeButtonText)
Sets the text of the negative button of the dialog. |
void
|
setNegativeButtonText(int negativeButtonTextResId)
|
void
|
setPositiveButtonText(int positiveButtonTextResId)
|
void
|
setPositiveButtonText(CharSequence positiveButtonText)
Sets the text of the positive button of the dialog. |
Protected methods | |
|---|---|
void
|
onClick()
Processes a click on the preference. |
Inherited methods | |
|---|---|
android.support.v7.preference.Preference
| |
java.lang.Object
| |
java.lang.Comparable
| |
DialogPreference (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
| Parameters | |
|---|---|
context |
Context
|
attrs |
AttributeSet
|
defStyleAttr |
int
|
defStyleRes |
int
|
DialogPreference (Context context, AttributeSet attrs, int defStyleAttr)
| Parameters | |
|---|---|
context |
Context
|
attrs |
AttributeSet
|
defStyleAttr |
int
|
DialogPreference (Context context, AttributeSet attrs)
| Parameters | |
|---|---|
context |
Context
|
attrs |
AttributeSet
|
Drawable getDialogIcon ()
Returns the icon to be shown on subsequent dialogs.
| Returns | |
|---|---|
Drawable |
The icon, as a Drawable.
|
int getDialogLayoutResource ()
Returns the layout resource that is used as the content View for subsequent dialogs.
| Returns | |
|---|---|
int |
The layout resource. |
CharSequence getDialogMessage ()
Returns the message to be shown on subsequent dialogs.
| Returns | |
|---|---|
CharSequence |
The message. |
CharSequence getDialogTitle ()
Returns the title to be shown on subsequent dialogs.
| Returns | |
|---|---|
CharSequence |
The title. |
CharSequence getNegativeButtonText ()
Returns the text of the negative button to be shown on subsequent dialogs.
| Returns | |
|---|---|
CharSequence |
The text of the negative button. |
CharSequence getPositiveButtonText ()
Returns the text of the positive button to be shown on subsequent dialogs.
| Returns | |
|---|---|
CharSequence |
The text of the positive button. |
void setDialogIcon (int dialogIconRes)
Sets the icon (resource ID) of the dialog. This will be shown on subsequent dialogs.
| Parameters | |
|---|---|
dialogIconRes |
int:
The icon, as a resource ID.
|
void setDialogIcon (Drawable dialogIcon)
Sets the icon of the dialog. This will be shown on subsequent dialogs.
| Parameters | |
|---|---|
dialogIcon |
Drawable:
The icon, as a Drawable.
|
void setDialogLayoutResource (int dialogLayoutResId)
Sets the layout resource that is inflated as the View to be shown
as the content View of subsequent dialogs.
| Parameters | |
|---|---|
dialogLayoutResId |
int:
The layout resource ID to be inflated. |
See also:
void setDialogMessage (CharSequence dialogMessage)
Sets the message of the dialog. This will be shown on subsequent dialogs.
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
message and it will be populated with this message.
| Parameters | |
|---|---|
dialogMessage |
CharSequence:
The message.
|
void setDialogMessage (int dialogMessageResId)
| Parameters | |
|---|---|
dialogMessageResId |
int:
The dialog message as a resource.
|
See also:
void setDialogTitle (int dialogTitleResId)
| Parameters | |
|---|---|
dialogTitleResId |
int:
The dialog title as a resource.
|
See also:
void setDialogTitle (CharSequence dialogTitle)
Sets the title of the dialog. This will be shown on subsequent dialogs.
| Parameters | |
|---|---|
dialogTitle |
CharSequence:
The title.
|
void setNegativeButtonText (CharSequence negativeButtonText)
Sets the text of the negative button of the dialog. This will be shown on subsequent dialogs.
| Parameters | |
|---|---|
negativeButtonText |
CharSequence:
The text of the negative button.
|
void setNegativeButtonText (int negativeButtonTextResId)
| Parameters | |
|---|---|
negativeButtonTextResId |
int:
The negative button text as a resource.
|
See also:
void setPositiveButtonText (int positiveButtonTextResId)
| Parameters | |
|---|---|
positiveButtonTextResId |
int:
The positive button text as a resource.
|
See also:
void setPositiveButtonText (CharSequence positiveButtonText)
Sets the text of the positive button of the dialog. This will be shown on subsequent dialogs.
| Parameters | |
|---|---|
positiveButtonText |
CharSequence:
The text of the positive button.
|
void onClick ()
Processes a click on the preference. This includes saving the value to
the SharedPreferences. However, the overridden method should
call callChangeListener(Object) to make sure the client wants to
update the preference's state with the new value.