I have the same problem. I want to pre-set the selection based on an _id that is not the same as the position. I display a set of codes in the spinner i.e.
_id display 4 blue 5 green i want when I have an _id of 4 to set the position to 0. I populate the spinner dynamically from a DB so it is not trivial to find the correspondence between the _id and corresponding position. I have to say that the Android API is EXTREMELY painful with regards to simple things like this! On Oct 3, 5:30 pm, "Megha Joshi" <[EMAIL PROTECTED]> wrote: > You could use Spinner's setSelection(int position) method. > > 2008/10/3 Lonzo1968 <[EMAIL PROTECTED]> > > > > > I feel almost embarrassed to ask this.. But how do you default the > > selection in a Spinner Widget? I have a Spinner that uses an > > ArrayAdapter<String> to fill the Selections. I get the value of the > > Spinner from a database, and now I want to set the Spinner to that > > selection when the user creates the Activity.. > > > This seems like it should be simple, but I just don't see a method to > > do this?? > > > Thanks, > > > LA --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---