Example usage for android.support.v4.preference PreferenceManager getDefaultSharedPreferences

List of usage examples for android.support.v4.preference PreferenceManager getDefaultSharedPreferences

Introduction

In this page you can find the example usage for android.support.v4.preference PreferenceManager getDefaultSharedPreferences.

Prototype

public static SharedPreferences getDefaultSharedPreferences(Context context) 

Source Link

Document

Gets a SharedPreferences instance that points to the default file that is used by the preference framework in the given context.

Usage

From source file:com.github.preferencefragment.preference.LaunchingPreferences.java

private void updateCounterText() {
    // Since we're in the same package, we can use this context to get
    // the default shared preferences
    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    final int counter = sharedPref.getInt(AdvancedPreferences.KEY_MY_PREFERENCE, 0);
    mCounterText.setText(getString(R.string.counter_value_is) + " " + counter);
}