Example usage for android.content Context MODE_PRIVATE

List of usage examples for android.content Context MODE_PRIVATE

Introduction

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

Prototype

int MODE_PRIVATE

To view the source code for android.content Context MODE_PRIVATE.

Click Source Link

Document

File creation mode: the default mode, where the created file can only be accessed by the calling application (or all applications sharing the same user ID).

Usage

From source file:Main.java

public static void putBoolean(Context mContext, String key, boolean values) {
    SharedPreferences sp = mContext.getSharedPreferences(SHARE_NAME, Context.MODE_PRIVATE);
    sp.edit().putBoolean(key, values).commit();
}

From source file:Main.java

public static String getString(Context mContext, String key, String values) {
    SharedPreferences sp = mContext.getSharedPreferences(SHARE_NAME, Context.MODE_PRIVATE);
    return sp.getString(key, values);
}

From source file:Main.java

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

From source file:Main.java

public static void writeConfig(Context context, String key, String val) {
    SharedPreferences share = context.getSharedPreferences("perference", Context.MODE_PRIVATE);
    Editor editor = share.edit();/*from ww  w .j a  v  a2s  . co m*/
    editor.putString(key, val);
    editor.commit();
}

From source file:Main.java

public static SharedPreferences getSharedPreference(Context context) {
    return context.getSharedPreferences(PRFERENCE_NAME_USER, Context.MODE_PRIVATE);
}

From source file:Main.java

public static int getValue(Context context, String key, int defValue) {
    SharedPreferences sp = context.getSharedPreferences(SETTING, Context.MODE_PRIVATE);
    int value = sp.getInt(key, defValue);
    return value;
}

From source file:Main.java

public static String getLoginUserPasswd(Context context) {

    SharedPreferences preferences = context.getSharedPreferences(XL_PREFERENCES, Context.MODE_PRIVATE);
    return preferences.getString("loginUserPasswd", "");
}

From source file:Main.java

public static boolean isMapHintVisible(Context context) {
    SharedPreferences sharedPref = context.getSharedPreferences(KEY_SHOW_MAP_HINT, Context.MODE_PRIVATE);
    return sharedPref.getBoolean(KEY_SHOW_MAP_HINT, true);
}

From source file:Main.java

public static void setGuideShowedPrefs(Context context, String key, boolean value) {
    SharedPreferences sp = context.getSharedPreferences(PRE_NAME, Context.MODE_PRIVATE);
    sp.edit().putBoolean(key, value).commit();
}

From source file:Main.java

public static boolean getBoolean(Context ctx, String key, boolean defaultValue) {
    SharedPreferences spf = ctx.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);

    return spf.getBoolean(key, defaultValue);
}