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 putPlaymode(Context context, String key, int values) {
    SharedPreferences sharedPreferences = context.getSharedPreferences("atqiye", Context.MODE_PRIVATE);
    sharedPreferences.edit().putInt(key, values).commit();
}

From source file:Main.java

static public void saveStringPreferences(Context context, String key, String value) {
    SharedPreferences pref = context.getSharedPreferences("pref", Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = pref.edit();
    editor.putString(key, value);//from  www  .  j a v  a 2  s.  co m
    editor.commit();
}

From source file:Main.java

public static void putString(Context context, String key, String value) {
    SharedPreferences.Editor editor = context.getSharedPreferences("MeiqiaSDK", Context.MODE_PRIVATE).edit();
    editor.putString(key, value);// w w  w . j  a  va2  s. c  om
    editor.apply();
}

From source file:Main.java

public static void putString(Context context, String key, String values) {
    SharedPreferences sharedPreferences = context.getSharedPreferences("atguigu", Context.MODE_PRIVATE);
    sharedPreferences.edit().putString(key, values).commit();
}

From source file:Main.java

public static SharedPreferences getSharedPreferences(Context ctx) {
    return ctx.getSharedPreferences("com.cpp2.sp.global", Context.MODE_PRIVATE);
}

From source file:Main.java

public static void putString(Context context, String key, String values) {

    SharedPreferences sharedPreferences = context.getSharedPreferences("atqiye", Context.MODE_PRIVATE);
    sharedPreferences.edit().putString(key, values).commit();
}

From source file:Main.java

public static void setupSharedPrefsMethods(Activity a) {
    prefs = a.getPreferences(Context.MODE_PRIVATE);
}

From source file:Main.java

public static int readPreferenceFile(Context context, String filename, String name) {
    SharedPreferences preference = context.getSharedPreferences(filename, Context.MODE_PRIVATE);
    int num = preference.getInt(name, 0);
    return num;/*from   w w w  .  j  a  va  2s.c o m*/
}

From source file:Main.java

public static String readSharedPreferenceString(Context context, String key) {
    SharedPreferences prefs = context.getSharedPreferences("org.rowanacm.android", Context.MODE_PRIVATE);

    return prefs.getString(key, ""); // the default value is an empty string
}

From source file:Main.java

public static void storeInSharedPreference(String key, String value, Context context) {
    SharedPreferences preferences = context.getSharedPreferences("TOKEN", Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = preferences.edit();
    editor.putString(key, value);/*from w  w w. j  a  v  a2  s . co  m*/
    editor.commit();
}