how to use spinner in android studio

Hello Guys. Welcome to our new tutorial on how to use spinner in android using android studio. spinner in android is like the drop-down menu with multiple values from which the end-user can select only one value. please follow the code given below how to use spinner in the android studio.

  • First Create a new project in Android Studio
  • File ⇒ New Android ⇒ Application Project
  • Then Open src -> package -> MainActivity.java and then add following code :

JAVA (MainActivity.java)

  •  Now Open res -> layout -> activity_main.xml and then add following code :

XML (activity_main.xml)

Output:

Finally, run this project.

This is how Android spinner looks like.

spinner in android spinner in android

Leave a Reply

Your email address will not be published. Required fields are marked *