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 void resetStartServiceFlag(Context context) {
    SharedPreferences sp = context.getSharedPreferences("you_notification", Activity.MODE_PRIVATE);
    sp.edit().putString(AUTO_STATE_FLAG, "1").commit();
}

From source file:Main.java

public static boolean isFirstTimeLaunch(Context context) {
    SharedPreferences prefs = context.getSharedPreferences(LAUNCH_DETAILS, context.MODE_PRIVATE);
    return prefs.getBoolean(USER_INFO, false);
}

From source file:Main.java

public static int balloonCount(Context context) {
    SharedPreferences sp = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
    return sp.getInt(KEY_BC, DEFAULT_BALLOON_COUNT);
}

From source file:Main.java

public static boolean isInitialised(Context context) {
    SharedPreferences prefs = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE);
    return prefs.getBoolean(PREF_INITIALISED, false);
}

From source file:Main.java

public static boolean isGuided(Context context) {
    SharedPreferences pref = context.getSharedPreferences(context.getPackageName() + "_preferences", 0);
    return pref.getBoolean(IS_GUIDED, false);
}

From source file:Main.java

public static float pullSen(Context context) {
    SharedPreferences sp = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
    return sp.getFloat(KEY_PS, DEFAULT_PULL_SENSITIVITY);
}

From source file:Main.java

public static void setNonWiFiTime(long time, Context context) {
    SharedPreferences sp = context.getSharedPreferences(PREFS_CACHE_ONE, 0);
    SharedPreferences.Editor editor = sp.edit();
    editor.putLong("nonWiFiTime", time);
    editor.commit();/*from   w w w  .j  a v a2  s. c om*/
}

From source file:Main.java

public static void setGetDooiooAllTime(long time, Context context) {
    SharedPreferences sp = context.getSharedPreferences(PREFS_CACHE_ONE, 0);
    SharedPreferences.Editor editor = sp.edit();
    editor.putLong("getDooiooAllTime", time);
    editor.commit();/*from   w w  w . j a  va  2s .  co m*/
}

From source file:Main.java

public static long flyDuration(Context context) {
    SharedPreferences sp = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
    return sp.getLong(KEY_BD, DEFAULT_FLY_DURATION);
}

From source file:Main.java

public static String getString(Context context, String key, String def) {
    return context.getSharedPreferences("MeiqiaSDK", Context.MODE_PRIVATE).getString(key, def);
}