bph
bph

Reputation: 11258

onSharedPreferenceChanged and PreferenceFragment

Trying to follow the examples given in http://developer.android.com/guide/topics/ui/settings.html but finding it difficult as it arbitrarily flips between using and not using fragments.

I've taken its advice to use fragments when implementing Preferences for my app as I'm using the most recent SDK (16)

I'm trying to implement onSharedPreferenceChanged method such that I can update the preference summaries when a user chages a preference value.

should I implement the callback method in the fragment or the parent Activity?

Upvotes: 1

Views: 1720

Answers (1)

jelies
jelies

Reputation: 9290

If you are supporting API levels from 11 to 16, onSharedPreferenceChanged() method has to be only implemented in your fragment.

You should only implement this method on activity in case you are supporting lower API levels.

Upvotes: 2

Related Questions