I am experiencing something strange with a Live Wallpaper. I very closely followed several examples out there on Live Wallpapers in regards to shared preference settings (e.g. Android sample app Cube Live Wallpaper).
The Engine implements SharedPreferences.OnSharedPreferenceChangeListener and the pertienent code in Engine looks like this: public static final String PREFS_NAME = "some-name"; Engine() { prefs = LiveWallpaperService.this.getSharedPreferences(PREFS_NAME, 0); prefs.registerOnSharedPreferenceChangeListener(this); } public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Log.e(getClass().getSimpleName(), "on shared preference changed"); } NOTE: I never unregister the Engine instance as a shared prefs listener. Although, I did move some things around to onCreate and onDestroy (added the unregister there) and had no impact as far as I could tell. The Settings class extends PreferenceActivity and implements SharedPreferences.OnSharedPreferenceChangeListener as well. And since that class has little code here is the body: @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); getPreferenceManager().setSharedPreferencesName(Engine.PREFS_NAME); addPreferencesFromResource(R.xml.settings); getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this); } @Override protected void onDestroy() { getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this); super.onDestroy(); } public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Log.e(getClass().getSimpleName(), "on shared preference changed"); } The only thing coming out in the log is from the Settings class for on shared pref change. Anyone have any idea why? In the implementations I've found for Live Wallpaper shared prefs settings, the Engine constructor either uses the shared preferences or calls to onSharedPreferenceChanged() directly. It seems like those other examples may be experiencing the same thing I described above, and they worked around it!?!? I do admit I have not taken the example code from others and tried it out to see if the Engine onSharedPreferenceChanged() gets called. I will do that tonight or this weekend. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en