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 context, String key, boolean value) {
    SharedPreferences sp = context.getSharedPreferences("budejie", Context.MODE_PRIVATE);
    sp.edit().putBoolean(key, value).commit();
}

From source file:Main.java

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

From source file:Main.java

public static void putBoolean(Context context, String key, Boolean value) {
    SharedPreferences sp = context.getSharedPreferences("atguigu", Context.MODE_PRIVATE);
    sp.edit().putBoolean(key, value).commit();

}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static void delete(Context context, int appWidgetId) {
    SharedPreferences prefs = context.getSharedPreferences("NETI_PREF", Context.MODE_PRIVATE);
    if (prefs != null) {
        SharedPreferences.Editor edit = prefs.edit();
        if (edit != null) {
            edit.remove("NETI_BARVA" + String.valueOf(appWidgetId));
            edit.commit();/*from w  w w.j a v  a 2 s  .  c  o  m*/
        }
    }
}

From source file:Main.java

public static void saveString(Context context, String key, String value) {
    SharedPreferences sp = context.getSharedPreferences("myshop", Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = sp.edit();
    editor.putString(key, value);//from  w w w  .  j  a va2s .c o m
    editor.commit();
}

From source file:Main.java

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