Android Spinner set Selected Item by Value

person shubham sharmafolder_openAndroidlocal_offer, access_time February 15, 2017

The spinner provides a way to set the selected valued based on the position using the setSelection(int position) method. Now to get the position based on a value you have to loop thru the spinner and get the position. Here is an example

If you are using an ArrayList for your Spinner Adapter then you can use that to loop thru and get the index. Another way is is to loop thru the adapter entries

 

warningComments are closed.