On Thu, Mar 11, 2010 at 10:13 PM, Nitesh <nite...@gmail.com> wrote:

> Hi all,
>

Sup?


> 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.
>

Item ID? Do you mean the index?


> 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.
>

OK, I assume you mean they don't have different indices, which is expected.


> So how do i differentiate from the two sets of data?
>

Well, you have spinner1 to tell you what the primary choice was, don't you?

 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"
>

 So check what the selection in spinner1 is after the selection in spinner2
is made. That will tell you its "ID", however you define that.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking

-- 
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

Reply via email to