Code example for Preference

Methods: getContextgetKeysetOnPreferenceChangeListener

     * immediately called with the preference's current value upon calling this method. 
    public static void setAndCallPreferenceChangeListener(Preference preference,
            Preference.OnPreferenceChangeListener listener) {
        // Set the listener to watch for value changes. 
        // Trigger the listener immediately with the preference's 
        // current value. 
                        .getBoolean(preference.getKey(), true));
     * Binds a preference's summary to its value. More specifically, when the preference's value is 
     * changed, its summary (line of text below the preference title) is updated to reflect the 
Contextual code suggestions in your IDE  Get Codota for Java