How would you go about making a spinner populate another spinner based on the first spinners selection?
So for example:
Spinner1 items are vegetarian or meat eater.
<string-array name="spinnerarray_veg_meat">
<item >Vegetarian</item>
<item >Meat eater</item>
</string-array>
Spinner2 would then need to display either vegetarian meal names or meat eater ones depending on spinner1's selection.
There are a number of ways to do it. One being, create an
Array
of meat items and one of vegetable items. InonItemSelected()
ofspinner1
set the adapter forspinner2
according to theposition
Spinner Docs
This link has many useful functions and properties available to
Spinner
sTo do this you'll have to set a
OnItemSelectedListener
on your firstSpinner
to populate the secondSpinner
programmatically.