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 SharedPreferences getCommonSharedPref(Context context) {
    return context.getSharedPreferences(SHARED_PREFERENCES_COMMON, Context.MODE_PRIVATE);
}

From source file:Main.java

public static SharedPreferences getSharedPreferences(Context ctx) {
    return ctx.getSharedPreferences("com.cpp2.sp.global", Context.MODE_PRIVATE);
}

From source file:Main.java

public static SharedPreferences sys_sp(Context context) {
    return context.getSharedPreferences("sys", Context.MODE_PRIVATE);
}

From source file:Main.java

public static void clearSP(Context context) {
    sp = context.getSharedPreferences("loginRes", 0);
    sp.edit().clear().commit();/*  w w w .ja  v a2s .c  om*/
}

From source file:Main.java

public static String getUserId(Context context) {
    return context.getSharedPreferences(VK_PREFERENCE, Activity.MODE_PRIVATE).getString(USER_ID, null);
}

From source file:Main.java

public static String getSid(Context context) {
    return context.getSharedPreferences(VK_PREFERENCE, Activity.MODE_PRIVATE).getString(SESSION_ID, null);
}

From source file:Main.java

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

From source file:Main.java

static public SharedPreferences getSharedPref(Context context) {
    return context.getSharedPreferences(ZPREFERENCES, Context.MODE_PRIVATE);
}

From source file:Main.java

/**
 * This method makes the user authorized
 *
 * @param context current context/*from w w w. j  ava 2 s  . c  o m*/
 */

public static void setAuthorized(Context context) {
    context.getSharedPreferences(LOGIN_PREFERENCES, Context.MODE_PRIVATE).edit()
            .putBoolean(PREFERENCES_AUTHORIZED_KEY, true).apply();
}

From source file:Main.java

public static String getVerifyCookie(Context context) {

    return context.getSharedPreferences(XL_PREFERENCES, Context.MODE_PRIVATE).getString("verifycookie", null);
}