This actually isn't an answer to the question.

I wanted to know if there was a way to do this without reimplementing
all the the
work done in addPreferencesFromResource in Java and Layouts.

Android encourages you to use the XML PreferencesScreen framework so that
you don't have to reimplement extensive preference screens in Java. This makes
preference screens retain look and feel between applications.
Furthermore, Android
(or a device manufacturer, particularly if the device is unusual form
factor) can
tweak the look and feel of such screens and such changes would be effective
across most Android applications.

It appears to me, that if you don't want users to have to click-through to see
the current value of a ListPreference, you can't use this wonderful framework.

I'd like to know if I can use the PreferencesScreen for this commonly needed
request. I already knew I could implement it from scratch if I wanted
to, but that
not only seems wasteful, it completely misses the advantages of using
PreferencesScreen in the first place.

P. V. Nasby


On Sat, Mar 6, 2010 at 1:00 PM, joebowbeer <[email protected]> wrote:
> You can customize ListPreference and call setSummary(getEntry()) in
> the onBindView and setValue overrides.
>
> See AndroidSnippets #34 example:
>
> http://www.androidsnippets.org/snippets/34/
>
> On Mar 6, 3:54 am, Petroleum Nasby <[email protected]> wrote:
>> I have an XML preferences screen which is handled by 
>> addPreferencesFromResource.
>>
>> On it, there is a ListPreference, for which I want the summary to
>> contain the current
>> value of that preference. I think this would be a common requirement,
>> as otherwise
>> you could not see the present value of the preference without expending a 
>> click.
>>
>> I read that the summary field supports resource references, and I see that I 
>> can
>> refer to preferences as android:summary="@+preference/prefname" in my
>> ListPreference.
>>
>> Clearly this is why resource references would be supported in this field.
>>
>> However, when I try this, instead of the present value of prefname, the text
>> "false" appears as the summary.
>>
>> Does anybody know how to display a current value without taking the seemingly
>> ridiculous step of rewriting the entire (large) preference screen in Java?
>>
>> I hope I have overlooked something simple.
>>
>> P. V. Nasby
>
> --
> 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

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