Search code examples
androidsharedpreferencesandroid-holo-everywhere

Instances of SharedPreferences in different SActivites share an inconsistent view of the data


I was using SharedPreferences and everything was working fine.

Then I started tweaking the UI. I added HoloEverywhere as a dependency and extended SActivity instead of Activity. Now none of the SharedPreferences work.

mPrefs = mCtx.getSharedPreferences(ctx.getPackageName(),
Context.MODE_PRIVATE);
mEditor = mPrefs.edit();

This is how I initialized my SP using android's SP at first. I noticed HE also has extended SP so I changed my code to using HE's PreferenceManager and SharedPreferences.

mPrefs = PreferenceManager.getDefaultSharedPreferences(ctx);
mEditor = mPrefs.edit();

However, none of my operations are still being saved into SP. Am I doing anything wrong here?


Solution

  • It turns out the behavior I have observed was indeed unexpected behavior. After reporting it, the author has fixed it. Kudos to him.