IT. Expert System.

Android Reference

PreferenceManager


android.preference

Class PreferenceManager

    • Field Detail

      • METADATA_KEY_PREFERENCES

        public static final String METADATA_KEY_PREFERENCES
        The Activity meta-data key for its XML preference hierarchy.
        See Also:
        Constant Field Values
    • Method Detail

      • inflateFromResource

        public PreferenceScreen inflateFromResource(Context context,
                                           int resId,
                                           PreferenceScreen rootPreferences)
        Inflates a preference hierarchy from XML. If a preference hierarchy is given, the new preference hierarchies will be merged in.
        Parameters:
        context - The context of the resource.
        resId - The resource ID of the XML to inflate.
        rootPreferences - Optional existing hierarchy to merge the new hierarchies into.
        Returns:
        The root hierarchy (if one was not provided, the new hierarchy's root).
      • setSharedPreferencesName

        public void setSharedPreferencesName(String sharedPreferencesName)
        Sets the name of the SharedPreferences file that preferences managed by this will use.
        Parameters:
        sharedPreferencesName - The name of the SharedPreferences file.
        See Also:
        Context.getSharedPreferences(String, int)
      • setSharedPreferencesMode

        public void setSharedPreferencesMode(int sharedPreferencesMode)
        Sets the mode of the SharedPreferences file that preferences managed by this will use.
        Parameters:
        sharedPreferencesMode - The mode of the SharedPreferences file.
        See Also:
        Context.getSharedPreferences(String, int)
      • getSharedPreferences

        public SharedPreferences getSharedPreferences()
        Gets a SharedPreferences instance that preferences managed by this will use.
        Returns:
        A SharedPreferences instance pointing to the file that contains the values of preferences that are managed by this.
      • getDefaultSharedPreferences

        public static SharedPreferences getDefaultSharedPreferences(Context context)
        Gets a SharedPreferences instance that points to the default file that is used by the preference framework in the given context.
        Parameters:
        context - The context of the preferences whose values are wanted.
        Returns:
        A SharedPreferences instance that can be used to retrieve and listen to values of the preferences.
      • setDefaultValues

        public static void setDefaultValues(Context context,
                            int resId,
                            boolean readAgain)
        Sets the default values from an XML preference file by reading the values defined by each Preference item's android:defaultValue attribute. This should be called by the application's main activity.

        Parameters:
        context - The context of the shared preferences.
        resId - The resource ID of the preference XML file.
        readAgain - Whether to re-read the default values. If false, this method sets the default values only if this method has never been called in the past (or if the KEY_HAS_SET_DEFAULT_VALUES in the default value shared preferences file is false). To attempt to set the default values again bypassing this check, set readAgain to true.

        Note: this will NOT reset preferences back to their default values. For that functionality, use getDefaultSharedPreferences(Context) and clear it followed by a call to this method with this parameter set to true.

      • setDefaultValues

        public static void setDefaultValues(Context context,
                            String sharedPreferencesName,
                            int sharedPreferencesMode,
                            int resId,
                            boolean readAgain)
        Similar to setDefaultValues(Context, int, boolean) but allows the client to provide the filename and mode of the shared preferences file.
        Parameters:
        context - The context of the shared preferences.
        sharedPreferencesName - A custom name for the shared preferences file.
        sharedPreferencesMode - The file creation mode for the shared preferences file, such as Context.MODE_PRIVATE or Context.MODE_PRIVATE
        resId - The resource ID of the preference XML file.
        readAgain - Whether to re-read the default values. If false, this method will set the default values only if this method has never been called in the past (or if the KEY_HAS_SET_DEFAULT_VALUES in the default value shared preferences file is false). To attempt to set the default values again bypassing this check, set readAgain to true.

        Note: this will NOT reset preferences back to their default values. For that functionality, use getDefaultSharedPreferences(Context) and clear it followed by a call to this method with this parameter set to true.

        See Also:
        setDefaultValues(Context, int, boolean), setSharedPreferencesName(String), setSharedPreferencesMode(int)


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: 8 / . Delta: 0.04919 с