Example usage for android.preference PreferenceScreen getSharedPreferences

List of usage examples for android.preference PreferenceScreen getSharedPreferences

Introduction

In this page you can find the example usage for android.preference PreferenceScreen getSharedPreferences.

Prototype

public SharedPreferences getSharedPreferences() 

Source Link

Document

Returns the SharedPreferences where this Preference can read its value(s).

Usage

From source file:nz.Intelx.DroidNetLogin.DroidNetLoginActivity.java

@Override
public void onPreferenceAttached(PreferenceScreen root, int xmlId) {

    if (root == null)
        return; //for whatever reason in very rare cases this is null              
    updatePreference(root.getSharedPreferences());

    //registering the listeners to the preference screen
    root.findPreference("login_preference").setOnPreferenceChangeListener(this);
    root.findPreference("debug_preference").setOnPreferenceChangeListener(this);
    root.findPreference("proxy_preference").setOnPreferenceChangeListener(this);
    root.findPreference("manual_login").setOnPreferenceClickListener(this);
    root.findPreference("manual_logout").setOnPreferenceClickListener(this);
    root.findPreference("manual_startProxy").setOnPreferenceClickListener(this);
    root.findPreference("manual_stopProxy").setOnPreferenceClickListener(this);

    //match summary for Login list preference to selected preference
    ListPreference login_preference = (ListPreference) root.findPreference("login_preference");
    CharSequence Login_Summary = login_preference.getEntry();
    login_preference.setSummary(Login_Summary);

}