Thursday, December 30, 2010

Re: [android-developers] Re: PreferenceActivity interface question

On Thu, Dec 30, 2010 at 4:25 PM, dashman <erjdriver@gmail.com> wrote:
> i tried to implement
> registerOnSharedPrefereneChangeListener()
>
> - is it correct that it works only from the PreferenceActivity
> sub-class.

No. You call that method on a SharedPreferences object. For a
PreferenceActivity, you specifically call it on a SharedPreferences
object you get from PreferenceManager.getDefaultSharedPreferences().
getDefaultSharedPreferences() can be called with any Context as its
parameter (e.g., your main activity). The listener you supply then
reacts to the changing preferences however is necessary.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in Atlanta: http://bignerdranch.com/classes/android

--
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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate