List of usage examples for android.content SharedPreferences getBoolean
boolean getBoolean(String key, boolean defValue);
From source file:Main.java
/** * Gets the preference.//from w w w.j a va 2 s . c o m * * @param key the key * @param defaultValue the default value * @return the preference */ public static boolean getPreference(String key, boolean defaultValue, Context c) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(c); return preferences.getBoolean(key, defaultValue); }
From source file:Main.java
public static void changeRingtone(Context context) { SharedPreferences sharedPreferences = context.getSharedPreferences("randomizer", Context.MODE_PRIVATE); if (!sharedPreferences.getBoolean("active", false)) { return;/*w ww .jav a 2 s . c om*/ } // END if RingtoneManager ringtoneManager = new RingtoneManager(context); Random random = new Random(System.currentTimeMillis()); int count = random.nextInt(ringtoneManager.getCursor().getCount()); RingtoneManager.setActualDefaultRingtoneUri(context, RingtoneManager.TYPE_RINGTONE, ringtoneManager.getRingtoneUri(count)); }
From source file:Main.java
public static boolean getDesktopBlocked(Context context) { SharedPreferences sp = sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE); ;//from ww w . j av a2 s . co m boolean newD = sp.getBoolean("desktopBlocked", false); return newD; }
From source file:Main.java
public static boolean getIsOpen(final Context mContext) { SharedPreferences preferences = mContext.getSharedPreferences("com.livechat.chat_open", Context.MODE_PRIVATE); return preferences.getBoolean("isOpen", false); }
From source file:Main.java
public static Boolean getActiveAccountAuthorized(final Context context) { SharedPreferences sp = getSharedPreferences(context); return hasActiveAccount(context) ? sp.getBoolean(makeAccountSpecificPrefKey(context, PREFIX_PREF_AUTHORIZED), false) : null;/* w ww .j a v a2 s. co m*/ }
From source file:Main.java
/** * check it is the first time enter into station list page *//*w w w .ja va2 s . c o m*/ public static boolean isFirstEnterStationList(Context context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); boolean isFirstEnter = prefs.getBoolean(FM_IS_FIRST_ENTER_STATION_LIST, true); if (isFirstEnter) { SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean(FM_IS_FIRST_ENTER_STATION_LIST, false); editor.commit(); } return isFirstEnter; }
From source file:Main.java
public static boolean getBoolSharedPref(Context context, String key, int mode) { SharedPreferences sharedPref = context.getSharedPreferences(SHARED_PREFERENCES_FILE, mode); boolean defaultValue = false; return sharedPref.getBoolean(key, defaultValue); }
From source file:Main.java
public static boolean judgeFirstIn(Context context) { SharedPreferences preferences = context.getSharedPreferences("isFirst", Context.MODE_PRIVATE); boolean isFirst = preferences.getBoolean("isFirst", true); int versionCode = preferences.getInt("versionCode", 1); if (isFirst || versionCode < getVersionCode(context)) { preferences.edit().putBoolean("isFirst", false).commit(); preferences.edit().putInt("versionCode", getVersionCode(context)).commit(); }// w w w. j ava 2 s . c o m // return isFirst; return false; }
From source file:com.emobc.android.profiling.Profile.java
public static boolean isFilled(Context context) { final SharedPreferences settings = getProfileData(context); return settings.getBoolean(Profile.PROFILE_FILLED, false); }
From source file:Main.java
/** * Test if the app hasn't be installed before * @param context//from w w w. ja v a 2 s. com * @return */ public static boolean isFirstRun(Context context) { SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFS_FILE, Context.MODE_PRIVATE); return prefs.getBoolean(getVersion(context), true); }