If you want to stick with using array resources, just make two arrays, one
with the things to display to the user, the other with the keys.

Otherwise, you can always make your own adapter, and load that from an XML
resource or anything else of whatever format you want.

On Sun, Jan 11, 2009 at 4:21 PM, Robert Green <rbgrn....@gmail.com> wrote:

>
> I'm familiar with arrays.xml to define static data sets for spinners
> and this works fine except that so far I am only able to define lists
> of values for the spinner.  What I need now is to have keys associated
> with those values so that in the future when I add new elements in
> arbitrary positions, it won't matter and the code won't have to be
> updated to handle it.  I'd like it if it worked like the select/option
> in html.
>
> The idea is to have a data set like this:
>
> Key / Value
> -----------------
> "flwr1" / "Rose"
> "flwr2" / "Daffodil"
>
> and the spinner would show
> "Rose"
> "Daffodil"
>
> but the code can get to
> "flwr1"
> "flwr2"
>
> Sounds easy enough, right?   Can anyone give me a quick code snippet
> to get me there?
>
> Thanks!
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~---------~--~----~------------~-------~--~----~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to