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 setTimeActive(Context context, boolean fl) {
    SharedPreferences sd = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = sd.edit();
    editor.putBoolean(TIME_ACTIVE, fl);
    editor.commit();/*from   w w  w.j a  v  a  2  s. co m*/
}

From source file:Main.java

public static void savePhone(Context context, String phone) {
    SharedPreferences preferences = context.getSharedPreferences(SETTINGS, Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = preferences.edit();
    editor.putString(PHONE, phone);/*from w w  w .  j av  a2 s.  c o m*/
    editor.apply();
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static boolean getDesktopBlocked(Context context) {
    SharedPreferences sp = sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE);
    ;//w ww .  j  a  v  a 2s.  c  o  m
    boolean newD = sp.getBoolean("desktopBlocked", false);
    return newD;
}

From source file:Main.java

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

From source file:Main.java

public static void setClickCount(Context context, int count) {
    SharedPreferences sd = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = sd.edit();
    editor.putInt(CLICK_COUTNT, count);/*from w  ww. j a v a2  s.  com*/
    editor.commit();
}

From source file:Main.java

public static void putJPushID(Context context, String value) {
    SharedPreferences sharedPreferences = context.getSharedPreferences(JPushID, Context.MODE_PRIVATE);
    SharedPreferences.Editor edit = sharedPreferences.edit();
    edit.putString(JPushID_K, value);/*from   w  ww . j a  va2 s.  c  o m*/
    edit.commit();
}

From source file:Main.java

public static void saveSharedPreInteger(Context context, String key, int value) {
    settings = context.getSharedPreferences(XML_Settings, Context.MODE_PRIVATE);
    settings.edit().putInt(key, value).commit();
}

From source file:Main.java

public static Boolean isNightMode(Context context) {
    Boolean result = false;/*from w  w  w  . j a  va2  s  .c  o  m*/

    try {
        SharedPreferences settings = context.getSharedPreferences("Settings", Context.MODE_PRIVATE);
        result = settings.getBoolean("night_mode", false);
    } catch (Exception e) {
        e.printStackTrace();
    }

    return result;
}