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 getShowInterface(Context context) {
    SharedPreferences sp = context.getSharedPreferences("alumni", Activity.MODE_PRIVATE);
    return sp.getBoolean("showintro", false);
}

From source file:Main.java

public static Map<String, ?> getAll(Context context) {
    SharedPreferences sp = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
    return sp.getAll();
}

From source file:Main.java

private static SharedPreferences getSharedPreferences(Context context, String sp_name) {
    return context.getSharedPreferences(sp_name, Context.MODE_PRIVATE);
}

From source file:Main.java

public static boolean isOnlyDestop(Context context) {
    SharedPreferences sp = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
    return sp.getBoolean(KEY_ONLY_DESTOP, false);
}

From source file:Main.java

public static long getLastLoadTime(Context context) {
    SharedPreferences share = context.getSharedPreferences("loaddataTime", context.MODE_PRIVATE);
    return share.getLong("time", 0);
}

From source file:Main.java

public static int getCurrentAppCatalog(Context context) {
    SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE);
    int newD = sp.getInt("currentAppCatalog", -1);
    return newD;//from   ww  w  .  ja v  a 2s.c  o m
}

From source file:Main.java

public static void clear(Context context) {
    SharedPreferences pref = context.getSharedPreferences(context.getPackageName() + "_preferences", 0);
    pref.edit().clear().commit();//w  w w  . ja  va 2 s.c o  m
}

From source file:Main.java

public static boolean isRunning(Context context) {
    SharedPreferences sp = context.getSharedPreferences(EXT_CONFIG, Context.MODE_PRIVATE);
    return sp.getBoolean(KEY_IS_RUNNING, false);
}

From source file:Main.java

public static SharedPreferences getCommonPreferences(final Context context) {
    return context.getSharedPreferences(COMMON_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
}

From source file:Main.java

public static SharedPreferences getCommonPreferences(final Context context) {
    return context.getSharedPreferences(COMMON_PREFERENCES_NAME, 0);
}