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 clear(Context context) {
    SharedPreferences sp = context.getApplicationContext().getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
    Editor editor = sp.edit();//from   ww w . ja  v  a 2 s.  c  o m
    editor.clear();
    editor.commit();
}

From source file:Main.java

public static String getValueOfSharedPreferences(Context context, String sharedName, String defaultValue) {
    SharedPreferences sharedPreferences = context.getSharedPreferences(SHARED_ID, Context.MODE_PRIVATE);
    return sharedPreferences.getString(sharedName, defaultValue);

}

From source file:Main.java

public static Boolean getRatingNoti(Context context) {
    Boolean result = true;//from w w  w .  j  a  v a  2 s  . c o  m

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

    return result;
}

From source file:Main.java

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

From source file:Main.java

public static void setUserLoggedIn(Context context) {
    Editor edit = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE).edit();
    edit.putBoolean(USER_LOGGED_IN, true);
    edit.commit();/*from  www  . j  a  v a 2s . c o m*/
}

From source file:Main.java

private static SharedPreferences getPrefences(Context context) {
    if (mSp == null) {
        mSp = context.getSharedPreferences(CONFIG_SP, Context.MODE_PRIVATE);
    }/*from  w ww .  ja  v a2s .  co  m*/
    return mSp;
}

From source file:Main.java

public static void setDefaultScreen(Context context, int screens) {
    SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = sp.edit();
    editor.putInt("defaultScreen", screens);
    editor.commit();/*from ww w  .  j  a  va2s. co  m*/
}

From source file:Main.java

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

From source file:Main.java

public static String getPersonName(String personId, String personGroupId, Context context) {
    SharedPreferences personIdNameMap = context.getSharedPreferences(personGroupId + "PersonIdNameMap",
            Context.MODE_PRIVATE);
    return personIdNameMap.getString(personId, "");
}

From source file:Main.java

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