I'm trying to implement spinner listener in button click handlers... Can we Implement Android spinner item selected listener in button click handler?
Asked
Active
Viewed 423 times
0
-
1did you try this : http://stackoverflow.com/questions/4923310/android-spinner-onitemselected-setonitemselectedlistener-not-triggering – 5511002233 Nov 05 '15 at 10:52
-
See [the docs](http://developer.android.com/guide/topics/ui/controls/spinner.html#SelectListener). – Blo Nov 05 '15 at 10:53
1 Answers
4
On your button click event use the following code to trigger the spinner.
Android Click and spinner selected listener:
1.spinner.performClick(); to open a spinner.
2.spinner.setSelectedItem(index);
First one will perform a normal click event just like we clik on a spinner. And the second one will set the specified index as selected spinner item, which trigger spinner item selected listener.

Amit Desale
- 1,281
- 3
- 16
- 43

Asha
- 41
- 5