Java android.preference SwitchPreference fields, constructors, methods, implement or subclass

Example usage for Java android.preference SwitchPreference fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for android.preference SwitchPreference.

The text is from its open source code.

Subclass

android.preference.SwitchPreference has subclasses.
Click this link to see all its subclasses.

Constructor

SwitchPreference(Context context)
Construct a new SwitchPreference with default style options.

Method

booleanisChecked()
Returns the checked state.
voidsetChecked(boolean checked)
Sets the checked state and saves it to the SharedPreferences .
voidsetDependency(String dependencyKey)
Sets the key of a Preference that this Preference will depend on.
voidsetEnabled(boolean enabled)
Sets whether this Preference is enabled.
voidsetKey(String key)
Sets the key for this Preference, which is used as a key to the SharedPreferences or PreferenceDataStore .
voidsetOnPreferenceChangeListener(OnPreferenceChangeListener onPreferenceChangeListener)
Sets the callback to be invoked when this Preference is changed by the user (but before the internal state has been updated).
voidsetOnPreferenceClickListener(OnPreferenceClickListener onPreferenceClickListener)
Sets the callback to be invoked when this Preference is clicked.
voidsetOrder(int order)
Sets the order of this Preference with respect to other Preference objects on the same level.
voidsetPersistent(boolean persistent)
Sets whether this Preference is persistent.
voidsetSummary(CharSequence summary)
Sets the summary for this Preference with a CharSequence.
voidsetSummaryOff(CharSequence summary)
Sets the summary to be shown when unchecked.
voidsetSummaryOn(CharSequence summary)
Sets the summary to be shown when checked.
voidsetSwitchTextOff(CharSequence offText)
Set the text displayed on the switch widget in the off state.
voidsetSwitchTextOff(@StringRes int resId)
Set the text displayed on the switch widget in the off state.
voidsetSwitchTextOn(CharSequence onText)
Set the text displayed on the switch widget in the on state.
voidsetSwitchTextOn(@StringRes int resId)
Set the text displayed on the switch widget in the on state.
voidsetTitle(CharSequence title)
Sets the title for this Preference with a CharSequence.