I’m using Android Studio Electric Eel to debug my app on a physical device. I have a code as like below :-
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
boolean present = preferences.contains("key");
if (present) {
// TODO
}
When I run the code and add a breakpoint at the conditional block, I see that present
evaluates to true
. However, at this breakpoint, if I evaluate the expression preferences.contains("key")
in the debugger, it outputs false
. What could be the reason for this?