I want most, but not all, of my non-CheckBox Preferences to show their
current values as summaries when displayed in a PreferenceActivity.
I've implemented this by overriding onSharedPreferenceChanged() in my
PreferenceActivity subclass.  For each SharedPreferences instance
passed in, onSharedPreferenceChanged() checks if the key is in a
hard-coded list and if so sets the summary from the current value of
the Preference.

It's a gross violation of OOP principles, but it works.

What I'd rather do is somehow mark individual Preference subclasses in
my xml file as desiring that behaviour.  I've read how to create
custom
xml tags, but I can't figure out how to get at them from inside a
PreferenceActivity.  It seems the only access to a View's AttributeSet
comes in its constructor, and I don't have access to that since I'm
only overriding the Activity that contains these Views.

I could accomplish the same thing by overriding every Preference
subclass I use, adding nothing but an 'implements SomeEmptyInterface'
statement.  I'd then test inside onSharedPreferenceChanged() whether
instances passed in implement that interface.  But adding a simple xml
attribute seems much cleaner.

Is it possible?

Thanks,

--Eric

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to