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 boolean getBoolean(Context context, String key) {
    SharedPreferences sp = context.getSharedPreferences(key, Context.MODE_PRIVATE);
    boolean value;
    value = sp.getBoolean(key, false);/* w w w  .j  a va 2 s .c o  m*/
    return value;
}

From source file:Main.java

public static void putInt(Context context, String key, int value) {
    SharedPreferences sp = context.getSharedPreferences("zexu", Context.MODE_PRIVATE);
    sp.edit().putInt(key, value).commit();
}

From source file:Main.java

public static void setString(Context ctx, String key, String value) {
    SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE);
    sp.edit().putString(key, value).commit();
}

From source file:Main.java

public static boolean getBoolean(Context context, String key) {
    SharedPreferences sp = context.getSharedPreferences("andy", Context.MODE_PRIVATE);
    return sp.getBoolean(key, false);
}

From source file:Main.java

public static void putString(String key, String value, Context ctx) {
    SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE);
    sp.edit().putString(key, value).commit();
}

From source file:Main.java

private static String getUserAccount(Context context) {
    SharedPreferences sp = context.getSharedPreferences("user_account", Context.MODE_PRIVATE);
    String user_account = sp.getString("user_account", "");
    return user_account;
}

From source file:Main.java

public static String getVerifyCookie(Context context) {

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

From source file:Main.java

public static String getChatBg(Context context, String key) {
    SharedPreferences spf = context.getSharedPreferences("chat", Context.MODE_PRIVATE);
    if (spf.contains(key)) {
        return spf.getString(key, "");
    }//from   w  w w.j av  a 2  s . c o  m
    return "";
}

From source file:Main.java

public static long getLong(Context context, String key) {

    SharedPreferences sp = context.getSharedPreferences("configdata", Context.MODE_PRIVATE);

    return sp.getLong(key, 0);
}

From source file:Main.java

public static String getUserID(Context mContext) {
    SharedPreferences sharedPref = mContext.getSharedPreferences("IdentifyInfos", Context.MODE_PRIVATE);
    return sharedPref.getString("sess_userid", "0");
}