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 float getFloat(Context context, String key) {
    SharedPreferences sp = context.getSharedPreferences(key, Context.MODE_PRIVATE);
    float value;/*from w  w w. ja v  a  2s  . c om*/
    value = sp.getFloat(key, -1F);
    return value;
}

From source file:Main.java

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

From source file:Main.java

public static String getUsrname(Context context) {

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

From source file:Main.java

public static int getInt(String key, int defValue, Context ctx) {
    SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE);
    return sp.getInt(key, defValue);
}

From source file:Main.java

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

From source file:Main.java

public static String getString(Context context, String key) {
    SharedPreferences sp = context.getSharedPreferences(key, Context.MODE_PRIVATE);
    String value;//from w ww. j  a v a  2  s .  c o  m
    value = sp.getString(key, "");
    return value;
}

From source file:Main.java

public static String getSessionid(Context context) {

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

From source file:Main.java

public static String getString(Context context, String key) {
    SharedPreferences sp = context.getSharedPreferences("myshop", Context.MODE_PRIVATE);
    return sp.getString(key, "");
}

From source file:Main.java

public static int getMode(String txt, Context context, String key) {
    SharedPreferences sp = context.getSharedPreferences(txt, Context.MODE_PRIVATE);
    return sp.getInt(key, -1);
}

From source file:Main.java

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