Hi, use spinner.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v, int position, long id) { } }); here the argument position gives the selected item in the spinner. On Fri, Mar 12, 2010 at 9:43 AM, Nitesh <nite...@gmail.com> wrote: > Hi all, > > I am a newbie coder and new to the SDK. I was just playing around with > an app that i made. I wanted to know as to how to retrieve the item id > of the selected item from the spinner when the spinner is re- > populated. > > For example, > I created 2 spinners, if you selected item 0 from spinner1 then > spinner2 will have a bunch of items and if you selected item 1 from > spinner1 then spinner2 will have a different set of items. Now, my > question is that when i select item 1 from spinner 1 then the items in > spinner2 dont have different ids. So how do i differentiate from the > two sets of data? > > To illustrate, > > User selected item 0 in spinner1 -> spinner2 gets data from array1 -> > item 0 in spinner2 has id '0' and item text is "apple" > > User selected item 1 in spinner1 -> spinner2 gets data from array2 -> > item 0 in spinner2 has id '0' and item text is "oranges" > > I know this sounds confusing but i hope the right people understood > it.. > > -- > 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<android-developers%2bunsubscr...@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 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