I have a similar problem like this, so I proceeded according to the proposed solution and added this line of code to onCreate:
PreferenceManager.setDefaultValues(this, R.xml.settings, false);
Unfortunately the problem still occurs, if the user hasn't altered the settings, still the default-value (true) from
mPreferences.getBoolean(String.valueOf(day_of_week), true)
is used instead of the default value from the XML.
One proposed to change the default-value parameter of getBoolean() to null, but this code crashes the app:
mPreferences.getBoolean(String.valueOf(day_of_week), (Boolean) null)
Any advice? Thanks in advance!