Example usage for android.content Context MODE_MULTI_PROCESS

List of usage examples for android.content Context MODE_MULTI_PROCESS

Introduction

In this page you can find the example usage for android.content Context MODE_MULTI_PROCESS.

Prototype

int MODE_MULTI_PROCESS

To view the source code for android.content Context MODE_MULTI_PROCESS.

Click Source Link

Document

SharedPreference loading flag: when set, the file on disk will be checked for modification even if the shared preferences instance is already loaded in this process.

Usage

From source file:Main.java

private static SharedPreferences getMultiDexPreferences(Context context) {
    return context.getSharedPreferences(PREFS_FILE, Context.MODE_MULTI_PROCESS);
}

From source file:Main.java

public static void clearStartPreferences() {
    SharedPreferences preferences;//from w  w  w  .  jav a2 s  . com
    SharedPreferences.Editor editor;
    preferences = context.getSharedPreferences("start", Context.MODE_MULTI_PROCESS);
    editor = preferences.edit();
    editor.clear();
    editor.commit();
}

From source file:Main.java

public static void putLongValue(Context mContext, String key, long n) {
    SharedPreferences pref = mContext.getSharedPreferences(AIO_SHARE_PREFS, Context.MODE_MULTI_PROCESS);
    SharedPreferences.Editor editor = pref.edit();
    editor.putLong(key, n);/*from  w w w.j av  a2 s .co m*/
    editor.commit();
}

From source file:Main.java

public static void putFloatValue(Context mContext, String key, float f) {
    SharedPreferences pref = mContext.getSharedPreferences(AIO_SHARE_PREFS, Context.MODE_MULTI_PROCESS);
    SharedPreferences.Editor editor = pref.edit();
    editor.putFloat(key, f);//w  w w . j a va  2s . c  om
    editor.commit();
}

From source file:Main.java

public static void putStringValue(Context mContext, String key, String s) {
    SharedPreferences pref = mContext.getSharedPreferences(AIO_SHARE_PREFS, Context.MODE_MULTI_PROCESS);
    SharedPreferences.Editor editor = pref.edit();
    editor.putString(key, s);/*from   w  ww  .j av  a  2s.co m*/
    editor.commit();
}

From source file:Main.java

public static Set<String> getStringSet(Context mContext, String key) {
    SharedPreferences pref = mContext.getSharedPreferences(AIO_SHARE_PREFS, Context.MODE_MULTI_PROCESS);
    return pref.getStringSet(key, null);
}

From source file:Main.java

public static void clearAllPreferences() {
    SharedPreferences preferences;/*from  w w  w .  j  av a2s. c  o  m*/
    SharedPreferences.Editor editor;
    preferences = context.getSharedPreferences("longpoll", Context.MODE_MULTI_PROCESS);
    editor = preferences.edit();
    editor.clear();
    editor.commit();
    preferences = context.getSharedPreferences("durov", Context.MODE_MULTI_PROCESS);
    editor = preferences.edit();
    editor.clear();
    editor.commit();
    preferences = PreferenceManager.getDefaultSharedPreferences(context);
    editor = preferences.edit();
    editor.clear();
    editor.commit();
}

From source file:Main.java

@SuppressWarnings("NewApi")
private static SharedPreferences getPrefs() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        return CONTEXT.getSharedPreferences(ARG_USER_KEY, Context.MODE_MULTI_PROCESS);
    } else {/*from ww  w  .ja  va2 s  . c  o m*/
        return CONTEXT.getSharedPreferences(ARG_USER_KEY, Context.MODE_PRIVATE);
    }
}

From source file:Main.java

private static SharedPreferences getSharePreference(Context context) {
    return context.getSharedPreferences(context.getPackageName() + "_preferences", Context.MODE_MULTI_PROCESS);
}

From source file:Main.java

public static SharedPreferences getSP(Context context, String name) {
    SharedPreferences shp = context.getSharedPreferences(name, Context.MODE_MULTI_PROCESS);
    return shp;//from  w  w w .  j  av  a2s .co  m
}