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 boolean getUseCelsius(Context context) {
    SharedPreferences pref = context.getSharedPreferences(SETTINGS_PREF, Context.MODE_PRIVATE);
    return pref.getBoolean(PREF_USE_CELSIUS, true);
}

From source file:Main.java

public static void setCurrentUserImageProfileUri(Context context, String uri) {
    SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFERENCES_FILE, Context.MODE_PRIVATE);
    prefs.edit().putString("userImageUri", uri).apply();
}

From source file:Main.java

public static String getStringValueInSharedPreference(Context context, String key, String defaultValue) {
    SharedPreferences sharedPref = context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE);
    return sharedPref.getString(key, defaultValue);
}

From source file:Main.java

public static void setSamsungESDKEnabled(Context context, Boolean value) {
    Editor edit = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE).edit();
    edit.putBoolean(SAMSUNG_ESDK, value);
    edit.commit();/*from w w  w .  j  a  v  a 2  s .  c o  m*/
}

From source file:Main.java

public static void unregisterChangeListener(Context context,
        SharedPreferences.OnSharedPreferenceChangeListener listener) {
    SharedPreferences sp = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
    sp.unregisterOnSharedPreferenceChangeListener(listener);
}

From source file:Main.java

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

From source file:Main.java

public static void storeLong(Context context, String key, long value) {
    SharedPreferences pre = context.getSharedPreferences(STORE_NAME, Context.MODE_PRIVATE);
    pre.edit().putLong(STORE_KEY_PREFIX + key, value).commit();
}

From source file:Main.java

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

From source file:Main.java

public static void storeFloat(Context context, String key, float value) {
    SharedPreferences pre = context.getSharedPreferences(STORE_NAME, Context.MODE_PRIVATE);
    pre.edit().putFloat(STORE_KEY_PREFIX + key, value).commit();
}

From source file:Main.java

public static void setIntPref(Context context, String name, int value) {
    SharedPreferences prefs = context.getSharedPreferences(APPLICATION_NAME, Context.MODE_PRIVATE);
    Editor ed = prefs.edit();/* w  ww .  j a  va  2s  .  c  o m*/
    ed.putInt(name, value);
    ed.commit();
}