For some reason, this returns true every time for the default value. I uninstalled my app and re-installed and i do the following to initialize the values. But for some reason the boolean is set to true instead of false.
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(LoadingActivity.this);
final int locationType = prefs.getInt(Constants.PREFS_LOCATION, 0);
final boolean skipWhatsNew = prefs.getBoolean(Constants.PREFS_DONT_SHOW_WHATS_NEW, false);
Log.v("loading activity : " , " " + skipWhatsNew);
I'm not really sure why its doing this since it used to just set the value to false before.
I already looked at similar questions but none of them helped, so any help would be nice, thanks.
Questions that i have looked at already,
Android - SharedPreference.getBoolean retrieving false even if i am storing true?
SharedPreferences.getBoolean returns true everytime
The above code is also the first time i access this, and from what i understand, it should set to false since it is being created for the first time. (first answer on this question mentions this, unless I'm wrong)
Constants.PREFS_DONT_SHOW_WHATS_NEW
. Please dont use your own constants in your post. How do we know whats in it? Just use a string literal so you post reproducable code. – Ellon