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 String getFromPreferences(String key, Context mContext) {
    SharedPreferences preferences = mContext.getSharedPreferences(TRACKER_PREFERENCES, Context.MODE_PRIVATE);
    return preferences.getString(key, null);
}

From source file:Main.java

public static void putUserPic(Context context, String city) {
    SharedPreferences preferences = context.getSharedPreferences(USERPIC, Context.MODE_PRIVATE);
    preferences.edit().putString(CVALUE, city).commit();
}

From source file:Main.java

public static void setUseCelsius(Context context, boolean use_celsius) {
    SharedPreferences pref = context.getSharedPreferences(SETTINGS_PREF, Context.MODE_PRIVATE);
    pref.edit().putBoolean(PREF_USE_CELSIUS, use_celsius).commit();
}

From source file:Main.java

public static String getUserPwd(Context context) {
    SharedPreferences preferences = context.getSharedPreferences(USER_INFO, Context.MODE_PRIVATE);
    String userPwd = preferences.getString(USER_PWD, "");
    return userPwd;
}

From source file:Main.java

public static String getVersion(Context context) {
    SharedPreferences preferences = context.getSharedPreferences(VERSION, Context.MODE_PRIVATE);
    String version = preferences.getString(VERSION_KEY, "1");
    return version;
}

From source file:Main.java

private static SharedPreferences getCountSP(Context context) {
    if (preferences == null) {
        preferences = context.getSharedPreferences(SEETING_RUN_SP, Context.MODE_PRIVATE);
    }/*w w  w . j  a  va 2 s .  c o m*/
    return preferences;
}

From source file:Main.java

public static Set<String> getAllPersonIds(String personGroupId, Context context) {
    SharedPreferences personIdSet = context.getSharedPreferences(personGroupId + "PersonIdSet",
            Context.MODE_PRIVATE);
    return personIdSet.getStringSet("PersonIdSet", new HashSet<String>());
}

From source file:Main.java

public static void cacheBalloonCount(Context context, int count) {
    SharedPreferences sp = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
    sp.edit().putInt(KEY_BC, count).commit();
}

From source file:Main.java

public static boolean isRunning(Context context) {
    SharedPreferences sp = context.getSharedPreferences(EXT_CONFIG, Context.MODE_PRIVATE);
    return sp.getBoolean(KEY_IS_RUNNING, false);
}

From source file:Main.java

public static String getUserIcon(Context context) {
    SharedPreferences preferences = context.getSharedPreferences(USER_INFO, Context.MODE_PRIVATE);
    String userIcon = preferences.getString(USER_ICON, "");
    return userIcon;
}