Android Spinner – UI Widget

spinner_tutorial

Spinner is a Android Widget which is used to select one value among lot of values given in array.It is very simple to work with. lets code –

Download Code

First of all you have to take spinner widget in activity_main.xml ,

Now in MainActivity.java you have to define a String type Array and adapter and set adapter to spinner .

Make sure your MainActivity.java file should implement AdapterView.OnItemSelectedListener . I take version Array of String type and Adapter aa .

MainActivity.java

Output –

spinner output spinner_output

For more queries and tutorials do post here and comment . Happy coding :p