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 int getNotReadCount(Context context) {
    SharedPreferences spf = context.getSharedPreferences("msg", Context.MODE_PRIVATE);
    return spf.getInt("count", 0);
}

From source file:Main.java

public static SharedPreferences getPref(Context context, String name) {
    return context.getSharedPreferences(name, Context.MODE_PRIVATE);
}

From source file:Main.java

public static File getDataUpdateDir(Activity act) {

    return act.getDir("update",
            Context.MODE_PRIVATE | Context.MODE_WORLD_READABLE | Context.MODE_WORLD_WRITEABLE);

}

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 . ja  v  a  2s.  c o m*/
}

From source file:Main.java

public static int getInt(Context context, String key) {
    SharedPreferences sp = context.getSharedPreferences("zexu", Context.MODE_PRIVATE);
    return sp.getInt(key, 0);
}

From source file:Main.java

public static int getInt(Context context, String key) {
    SharedPreferences sp = context.getSharedPreferences(key, Context.MODE_PRIVATE);
    int value;//from ww  w. j  ava 2s .  c o m
    value = sp.getInt(key, -1);
    return value;
}

From source file:Main.java

public static String getUID(Context context) {

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

From source file:Main.java

public static void clearUser(Context context) {
    SharedPreferences preferences = context.getSharedPreferences("USER", Context.MODE_PRIVATE);
    preferences.edit().clear().commit();
}

From source file:Main.java

public static String getSalesId(Context context) {
    SharedPreferences pref = context.getSharedPreferences("sales", Context.MODE_PRIVATE);
    if (pref != null) {
        return pref.getString("SalesId", "");
    }/*ww  w  .  j  av  a  2 s  .  c o  m*/
    return null;
}

From source file:Main.java

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