PreferenceManager.getDefaultSharedPreferences(context)
and
getPreferences()
seem to retrieve different Preferences.
PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
"userWasAskedToEnableGps", false);
for me returns false,
getPreferences(MODE_PRIVATE).getBoolean("userWasAskedToEnableGps", false);
returns true.
The Preference was written with an Editor like
Editor e = getPreferences(MODE_PRIVATE).edit();
e.putBoolean (...);
e.commit();
How can I get the same Preferences outside of an Activity from the Context?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…