Well i already know how to get the item and which index. My problem is that the index is same irrespective of what was selected in spinner 1. How do i know whether spinner 1 was selected or spinner 2?
Thanks! On Sat, Mar 13, 2010 at 10:07 PM, murali raju <[email protected]> wrote: > 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 <[email protected]> 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 [email protected] >> To unsubscribe from this group, send email to >> [email protected]<android-developers%[email protected]> >> 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 [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Sincerely, Nitesh Mehta Growing old is mandatory. Growing up? Definitely optional. -- 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

