Hi,

I want Drop Down List with id/value pair.

I already see the example of spinner But I want dynamic id as result
when value is select not default id.

Like srings.xml :-

<string-array name="planets_array">
        <item id="1">Mercury</item>
        <item id="2">Venus</item>
        <item id="3">Earth</item>
        <item id="4">Mars</item>
        <item id="5">Jupiter</item>
        <item id="6">Saturn</item>
        <item id="7">Uranus</item>
        <item id="8">Neptune</item>
    </string-array>

When fetch using below code :-

public void onItemSelected(AdapterView<?> parent,
        View view, int pos, long id) {
      Toast.makeText(parent.getContext(), "The planet is " +
                  parent.getItemIdAtPosition(pos)+" -
>"+parent.getItemAtPosition(pos).toString(),
Toast.LENGTH_LONG).show();
    }

it show id is 0 when Select Mercury But I want it show 1 as set in id.
Please help me out.

Thanks with Regards
Saurabh Goyal

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

Reply via email to