L2wis L2wis - 27 days ago 12
Android Question

Android create a spinner with items that have a hidden value and display some text?

I'm sure this is asked plenty and i've found some questions on here similar but none really got the coin dropping for me. I'm hoping someone can help me out.

What I want to do is present the user with a dropdown (spinner) with a list of flavours Vanilla, Chocolate, Strawberry.

When the user selected the flavour of their choice the I want the value of Strawberry which is 10 to be returned.

Strawberry = 10
Chocolate = 20
Vanilla = 30


I come from a vb.net background so finding this incredibly hard to work with the fact i need arrayadapters and stuff to do it?

Could anyone simplify things for me and perhaps share some code?

Answer Source

i think this post will help you Android: How to bind spinner to custom object list?

this question author has the same requirement as you