Example usage for android.content Context getSharedPreferences

List of usage examples for android.content Context getSharedPreferences

Introduction

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

Prototype

public abstract SharedPreferences getSharedPreferences(File file, @PreferencesMode int mode);

Source Link

Document

Retrieve and hold the contents of the preferences file, returning a SharedPreferences through which you can retrieve and modify its values.

Usage

From source file:Main.java

private static String getUserAccount(Context context) {
    SharedPreferences sp = context.getSharedPreferences("user_account", Context.MODE_PRIVATE);
    String user_account = sp.getString("user_account", "");
    return user_account;
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static int getSharedPreInteger(Context context, String key) {
    settings = context.getSharedPreferences(XML_Settings, Context.MODE_PRIVATE);
    return settings.getInt(key, 0);
}

From source file:Main.java

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

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 String getHomeBindingAppToLaunchPackageName(Context context) {
    SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE);
    return "";
}

From source file:Main.java

public static int loadActivityStatus(Context context) {
    SharedPreferences pref = context.getSharedPreferences("ActivityStatus", Context.MODE_PRIVATE);
    return pref.getInt("activity_status", ERROR_STATUS);
}

From source file:Main.java

public static void putSharedPreferencesBoolean(Context context, String key, boolean value) {
    context.getSharedPreferences(SP_FIRST_START, 0).edit().putBoolean(key, value).commit();
}

From source file:Main.java

public static SharedPreferences readSharedPref(Context context, String sharedPref) {
    return context.getSharedPreferences(sharedPref, 0);
}