Sunday, February 3, 2013

[android-developers] Re: Alpha ordering ListPreference values to suit current locale

OK, I guess I mustn't have expressed myself clearly.
I can't see how a preference is going to help here.

I can provide an explicit ordering in each an every resource locale that suits that locale. But I'm wondering whether there is a programmatic (or other) way to ensure that the values displayed by a ListPreference are in alpha order for the current locale?

William


On Saturday, February 2, 2013 12:50:49 PM UTC+10, lbendlin wrote:
smells like a database driven custom preference to me.

On Friday, February 1, 2013 9:13:09 PM UTC-5, William Ferguson wrote:
What's the optimal way to ensure that the values in a ListPreference are alpha ordered according to the current locale?

Eg if my list contains languages
<string-array name="language_keys">
  <item>cs</item>
  <item>da</item>
  <item>de</item>
  <item>en</item>
  <item>es</item>
  <item>fi</item>
</string-array>

<string-array name="language_values"> <!-- English displays -->
  <item>Czech</item>
  <item>Danish</item>
  <item>German</item>
  <item>English</item>
  <item>Spanish</item>
  <item>Finnish</item>
</string-array>

<string-array name="language_values"> <!-- German displays -->
  <item>Tschechisch</item>
  <item>Dänisch</item>
  <item>Deutsch</item>
  <item>Englisch</item>
  <item>Spanisch</item>
  <item>Finnisch</item>
</string-array>

Should I replicate the keys and values in all resource locales and change their order to suit? Or is their some way that I haven't found yet where I can readily apply a sort to the ListPreference keys and values?

William

--
--
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
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment