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

public static boolean isEnableGprs(Context context) {
    SharedPreferences sp = context.getSharedPreferences(PREFS_CACHE_ONE, 0);
    return sp.getBoolean("isEnableGprs", false);
}

From source file:Main.java

public static boolean clearUserInfo(Context context) {
    SharedPreferences sp = context.getSharedPreferences("saveSelfInfo", 0);
    return sp.edit().clear().commit();
}

From source file:Main.java

public static long getDownloadSuccessTime(Context context) {
    SharedPreferences sp = context.getSharedPreferences(PREFS_CACHE_ONE, 0);
    return sp.getLong("downloadSuccessTime", 0);
}

From source file:Main.java

public static void bind(Context context) {
    SharedPreferences sp = context.getSharedPreferences("pre_tuisong", Context.MODE_PRIVATE);
    sp.edit().putBoolean(BIND__FLAG, true).commit();
}

From source file:Main.java

public static void unbind(Context context) {
    SharedPreferences sp = context.getSharedPreferences("pre_tuisong", Context.MODE_PRIVATE);
    sp.edit().putBoolean(BIND__FLAG, false).commit();
}

From source file:Main.java

public static String getPhoneNumber(Context context) {
    SharedPreferences prefs = context.getSharedPreferences("LOGIN_preferences", Context.MODE_PRIVATE);
    return prefs.getString("PHONE", "");
}

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 SharedPreferences getNotificationSettings(Context context, int slot) {
    return context.getSharedPreferences(getNotificationName(slot), Context.MODE_WORLD_READABLE);
}

From source file:Main.java

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

From source file:Main.java

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