List of usage examples for android.content Context getSharedPreferences
public abstract SharedPreferences getSharedPreferences(File file, @PreferencesMode int mode);
From source file:Main.java
public static void clearAlarmRecord(Context context) { SharedPreferences sh = context.getSharedPreferences("alarm_record", Activity.MODE_PRIVATE); sh.edit().clear().commit();/* ww w . j ava 2 s .c om*/ }
From source file:Main.java
public static void createPreferences(Context context) { SharedPreferences pref = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); Editor editor = pref.edit();/*from w w w. j a v a 2s . c om*/ editor.commit(); System.out.println("Preferences created"); }
From source file:Main.java
public static int getAlarmRecord(Context context) { SharedPreferences sh = context.getSharedPreferences("alarm_record", Activity.MODE_PRIVATE); return sh.getInt("alarmRecord", -1); }
From source file:Main.java
public static void resetPref(Context context) { SharedPreferences pref = context.getSharedPreferences("TVGuide", Context.MODE_PRIVATE); Editor editor = pref.edit();/*from w ww. j av a 2 s . com*/ editor.clear(); editor.apply(); }
From source file:Main.java
public static void storeDevieId(String deviceId, Context context) { SharedPreferences mPrefs = context.getSharedPreferences(DEVICE_ID_FILE, Context.MODE_PRIVATE); mPrefs.edit().putString(deviceId, DEVICE_ID_KEY).commit(); }
From source file:Main.java
public static String getValueFromSP(Context ctx, String Key) { SharedPreferences sp = ctx.getSharedPreferences("config_info", 0); return sp.getString(Key, ""); }
From source file:Main.java
static int loadLastPhoneCount(Context context) { SharedPreferences prefs = context.getSharedPreferences(AGE_PREFERENCES, Context.MODE_PRIVATE); return prefs.getInt(AGE_LAST_PHONE_COUNT, -1); }
From source file:Main.java
public static String getCacheData(Context context) { SharedPreferences settings = context.getSharedPreferences("Preference", 0); String cacheData = settings.getString("CacheData", ""); return cacheData; }
From source file:Main.java
public static String getCity(Context context) { SharedPreferences sp = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE); if (sp != null) { return sp.getString(KEY_CITY, "null"); }//from w w w . ja v a 2 s.com return ""; }
From source file:Main.java
public static SharedPreferences getshared(Context context) { SharedPreferences preferences = context.getSharedPreferences("bbusers", Context.MODE_PRIVATE); return preferences; }