Oh Holy Experts:
I know this is an easy one to start off the morning. I haven't worked with
spinners before and I am trying to set the value of a spinner.
The only examples I can find on the first 5 pages of a Google search refer
to Spinner.setSelection(). That's great once I find out the ordinal of the
selection I need, but I don't know it yet!
The value I get is from the phone database, say "red", and I have a spinner
like so:
array_spinner = new String[5];
array_spinner[0] = "blue";
array_spinner[1] = "green";
array_spinner[2] = "red";
array_spinner[3] = "uglycolor";
array_spinner[4] = "someothercolor";
Spinner s = (Spinner) findViewById(R.id.res_color);
ArrayAdapter adapter = new ArrayAdapter(this,
android.R.layout.simple_spinner_item, array_spinner);
s.setAdapter(adapter);
s.setSelection(2);
So, the question is how do I get from "red" to "2"?! There must be some
setSelectionByValue() or getSelectionIndex() function, right?
Thanks,
Nick Owens
VP, ThreeClix
Office: (904) 429-7039
Mobile: (847) 565-9392
After Hours: (904) 540-5830
--
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