IT. Expert System.

Android Reference

TwoStatePreference


android.preference

Class TwoStatePreference

  • All Implemented Interfaces:
    Comparable<Preference>
    Direct Known Subclasses:
    CheckBoxPreference, SwitchPreference


    public abstract class TwoStatePreference
    extends Preference
    Common base class for preferences that have two selectable states, persist a boolean value in SharedPreferences, and may have dependent preferences that are enabled/disabled based on the current state.
    • Constructor Detail

      • TwoStatePreference

        public TwoStatePreference(Context context,
                          AttributeSet attrs,
                          int defStyle)
      • TwoStatePreference

        public TwoStatePreference(Context context)
    • Method Detail

      • setChecked

        public void setChecked(boolean checked)
        Sets the checked state and saves it to the SharedPreferences.
        Parameters:
        checked - The checked state.
      • isChecked

        public boolean isChecked()
        Returns the checked state.
        Returns:
        The checked state.
      • shouldDisableDependents

        public boolean shouldDisableDependents()
        Description copied from class: Preference
        Checks whether this preference's dependents should currently be disabled.
        Overrides:
        shouldDisableDependents in class Preference
        Returns:
        True if the dependents should be disabled, otherwise false.
      • setSummaryOn

        public void setSummaryOn(CharSequence summary)
        Sets the summary to be shown when checked.
        Parameters:
        summary - The summary to be shown when checked.
      • setSummaryOn

        public void setSummaryOn(int summaryResId)
        Parameters:
        summaryResId - The summary as a resource.
        See Also:
        setSummaryOn(CharSequence)
      • getSummaryOn

        public CharSequence getSummaryOn()
        Returns the summary to be shown when checked.
        Returns:
        The summary.
      • setSummaryOff

        public void setSummaryOff(CharSequence summary)
        Sets the summary to be shown when unchecked.
        Parameters:
        summary - The summary to be shown when unchecked.
      • setSummaryOff

        public void setSummaryOff(int summaryResId)
        Parameters:
        summaryResId - The summary as a resource.
        See Also:
        setSummaryOff(CharSequence)
      • getSummaryOff

        public CharSequence getSummaryOff()
        Returns the summary to be shown when unchecked.
        Returns:
        The summary.
      • getDisableDependentsState

        public boolean getDisableDependentsState()
        Returns whether dependents are disabled when this preference is on (true) or when this preference is off (false).
        Returns:
        Whether dependents are disabled when this preference is on (true) or when this preference is off (false).
      • setDisableDependentsState

        public void setDisableDependentsState(boolean disableDependentsState)
        Sets whether dependents are disabled when this preference is on (true) or when this preference is off (false).
        Parameters:
        disableDependentsState - The preference state that should disable dependents.
      • onGetDefaultValue

        protected Object onGetDefaultValue(TypedArray a,
                               int index)
        Description copied from class: Preference
        Called when a Preference is being inflated and the default value attribute needs to be read. Since different Preference types have different value types, the subclass should get and return the default value which will be its value type.

        For example, if the value type is String, the body of the method would proxy to TypedArray.getString(int).

        Overrides:
        onGetDefaultValue in class Preference
        Parameters:
        a - The set of attributes.
        index - The index of the default value attribute.
        Returns:
        The default value of this preference type.
      • onSetInitialValue

        protected void onSetInitialValue(boolean restoreValue,
                             Object defaultValue)
        Description copied from class: Preference
        Implement this to set the initial value of the Preference.

        If restorePersistedValue is true, you should restore the Preference value from the SharedPreferences. If restorePersistedValue is false, you should set the Preference value to defaultValue that is given (and possibly store to SharedPreferences if Preference.shouldPersist() is true).

        This may not always be called. One example is if it should not persist but there is no default value given.

        Overrides:
        onSetInitialValue in class Preference
        Parameters:
        restoreValue - True to restore the persisted value; false to use the given defaultValue.
        defaultValue - The default value for this Preference. Only use this if restorePersistedValue is false.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 839 / . Delta: 0.02849 с