Re: [android-developers] OnSharedPreferenceChangeListener never receives callback

2010-06-15 Thread Connick
Cancel that, I just grasped what you were getting at. :)


On Tue, Jun 15, 2010 at 5:18 PM, Connick  wrote:

> Will file a big, thx!
>
>
> On Tue, Jun 15, 2010 at 4:45 PM, Mark Murphy wrote:
>
>> On Tue, Jun 15, 2010 at 4:42 PM, Connick  wrote:
>> > Interesting, it only works if used within an activity that extends
>> > PreferenceActivity. Crap.
>>
>> So long as all components are using the same preference file, it
>> should work for modifications from any source. That is what I meant by
>> "correct" in my previous reply.
>>
>> --
>> Mark Murphy
>> CommonsWare
>> mmur...@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+unsubscr...@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] OnSharedPreferenceChangeListener never receives callback

2010-06-15 Thread Connick
Will file a big, thx!

On Tue, Jun 15, 2010 at 4:45 PM, Mark Murphy wrote:

> On Tue, Jun 15, 2010 at 4:42 PM, Connick  wrote:
> > Interesting, it only works if used within an activity that extends
> > PreferenceActivity. Crap.
>
> So long as all components are using the same preference file, it
> should work for modifications from any source. That is what I meant by
> "correct" in my previous reply.
>
> --
> Mark Murphy
> CommonsWare
> mmur...@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+unsubscr...@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] OnSharedPreferenceChangeListener never receives callback

2010-06-15 Thread Mark Murphy
On Tue, Jun 15, 2010 at 4:42 PM, Connick  wrote:
> Interesting, it only works if used within an activity that extends
> PreferenceActivity. Crap.

So long as all components are using the same preference file, it
should work for modifications from any source. That is what I meant by
"correct" in my previous reply.

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


Re: [android-developers] OnSharedPreferenceChangeListener never receives callback

2010-06-15 Thread Connick
Interesting, it only works if used within an activity that extends
PreferenceActivity. Crap.


On Tue, Jun 15, 2010 at 4:40 PM, Connick  wrote:

> 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 wrote:
>
>> On Tue, Jun 15, 2010 at 4:25 PM, Connick  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
>> mmur...@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+unsubscr...@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] OnSharedPreferenceChangeListener never receives callback

2010-06-15 Thread Mark Murphy
On Tue, Jun 15, 2010 at 4:40 PM, Connick  wrote:
> 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?

Correct.

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


Re: [android-developers] OnSharedPreferenceChangeListener never receives callback

2010-06-15 Thread Connick
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 wrote:

> On Tue, Jun 15, 2010 at 4:25 PM, Connick  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
> mmur...@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+unsubscr...@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] OnSharedPreferenceChangeListener never receives callback

2010-06-15 Thread Mark Murphy
On Tue, Jun 15, 2010 at 4:25 PM, Connick  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
mmur...@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en