Tuesday, June 15, 2010

Re: [android-developers] OnSharedPreferenceChangeListener never receives callback

No effect. I'm registering the listener in onCreate of my activity, not sure if that has any implications. I've also been assuming this should fire when prefs are either changed via a pref activity and/or when a commit is called from a shared pref editor?

-Stace


On Tue, Jun 15, 2010 at 4:28 PM, Mark Murphy <mmurphy@commonsware.com> wrote:
On Tue, Jun 15, 2010 at 4:25 PM, Connick <oconnick@gmail.com> wrote:
> I'm trying to listen for preference changes from an activity (see below). It
> never fires. Is it due to the fact that the activity in question is not in
> focus when the change event fires?

It shouldn't be. It works in services, and services never have the focus.

> sharedPrefs = PreferenceManager.getDefaultSharedPreferences(
> getApplicationContext() );

Try using "this" instead of "getApplicationContext()"

--
Mark Murphy
CommonsWare
mmurphy@commonsware.com
http://commonsware.com

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment