Example usage for android.content Context getSharedPreferences

List of usage examples for android.content Context getSharedPreferences

Introduction

In this page you can find the example usage for android.content Context getSharedPreferences.

Prototype

public abstract SharedPreferences getSharedPreferences(File file, @PreferencesMode int mode);

Source Link

Document

Retrieve and hold the contents of the preferences file, returning a SharedPreferences through which you can retrieve and modify its values.

Usage

From source file:Main.java

public static String getUserFromPrefrence(Context context) {
    SharedPreferences sh = context.getSharedPreferences("xmeet_prefrence", Context.MODE_PRIVATE);
    return sh.getString("nickname", "");
}

From source file:Main.java

public static void putBoolean(Context context, String key, boolean value) {
    context.getSharedPreferences("atguigu", Context.MODE_PRIVATE).edit().putBoolean(key, value).commit();
}

From source file:Main.java

public static boolean isDownloading(Context context) {
    SharedPreferences sp = context.getSharedPreferences(PREFS_CACHE_ONE, 0);
    return sp.getBoolean("isDownloading", false);
}

From source file:Main.java

public static int readSize(Context context) {
    SharedPreferences sp = context.getSharedPreferences("setSizeData", Context.MODE_PRIVATE);
    int size = sp.getInt("size", 2);
    return size;/*from  w  w w  .jav  a 2  s.com*/
}

From source file:Main.java

static SharedPreferences getPreferences(Context context) {
    return context.getSharedPreferences(PREF_FILE_NAME, Context.MODE_PRIVATE);
}

From source file:Main.java

public static boolean isBind(Context context) {
    SharedPreferences sp = context.getSharedPreferences("pre_tuisong", Context.MODE_PRIVATE);
    return sp.getBoolean(BIND__FLAG, false);
}

From source file:Main.java

public static void set(Context context, String key, boolean value) {
    context.getSharedPreferences("marsroot", 0).edit().putBoolean(key, value).commit();
}

From source file:Main.java

public static float getWindowX(Context context) {
    SharedPreferences sp = context.getSharedPreferences(PREFS_CACHE_ONE, 0);
    return sp.getFloat("x", 0);
}

From source file:Main.java

public static long getGetDooiooAllTime(Context context) {
    SharedPreferences sp = context.getSharedPreferences(PREFS_CACHE_ONE, 0);
    return sp.getLong("getDooiooAllTime", 0);
}

From source file:Main.java

public static boolean isShowView(Context context) {
    SharedPreferences sp = context.getSharedPreferences(PREFS_CACHE_ONE, 0);
    return sp.getBoolean("isShowView", false);
}