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 putString(Context context, String key, String value) {
    if (sp == null) {
        sp = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
    }//  w  ww  . j a  v a2s .  co  m
    sp.edit().putString(key, value).commit();
}

From source file:Main.java

public static Set<String> getAllFaceIds(String personId, Context context) {
    SharedPreferences faceIdSet = context.getSharedPreferences(personId + "FaceIdSet", Context.MODE_PRIVATE);
    return faceIdSet.getStringSet("FaceIdSet", new HashSet<String>());
}

From source file:Main.java

private static SharedPreferences getPreferencs(Context context) {
    if (mSp == null) {
        mSp = context.getSharedPreferences(CONFIG_SP, Context.MODE_PRIVATE);
    }/* w  ww  .java  2s .c  o m*/
    return mSp;
}

From source file:Main.java

public static void setUserLoggedOut(Context context) {
    Editor edit = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE).edit();
    edit.putBoolean(USER_LOGGED_IN, false);
    edit.commit();//  ww w  . j  av  a 2 s .  c  o  m
}

From source file:Main.java

public static void setCameraActive(Context context, boolean fl) {
    SharedPreferences sd = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = sd.edit();
    editor.putBoolean(CAMERA_ACTIVE, fl);
    editor.commit();/*from w ww  . j a  va2s  .c  o  m*/
}

From source file:Main.java

public static void setDesktopScreens(Context context, int screens) {
    SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = sp.edit();
    editor.putInt("desktopScreens", screens - 1);
    editor.commit();//w  w w.jav a  2  s. c  o m
}

From source file:Main.java

public static void setPreference(Context context, String key, String value) {
    SharedPreferences.Editor prefsEditor = context.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE)
            .edit();//from  w w w  .  j a v a  2  s.c  o m
    prefsEditor.putString(key, value);
    prefsEditor.commit();
}

From source file:Main.java

public static boolean getNotiDoNotShowFlag(Context context) {
    SharedPreferences sd = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
    return sd.getBoolean(DO_NOT_SHOW_FLAG, true);

}

From source file:Main.java

public static void setCurrentAppCatalog(Context context, int group) {
    SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = sp.edit();
    editor.putInt("currentAppCatalog", group);
    editor.commit();/*from   ww w .  j  av  a 2  s .co m*/
}

From source file:Main.java

public static String getSwipeDownAppToLaunchPackageName(Context context) {
    SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE);
    return "";
}