Android Spinner

Categories: Android // Tags: , .

// By:Team // No Comment

Email this to someonePrint this pageShare on Google+1Share on Facebook0Tweet about this on TwitterShare on LinkedIn0Share on Reddit0Pin on Pinterest0Share on StumbleUpon2
  • Android Spinner is like the combox box of AWT or Swing. It can be used to display the multiple options to the user in which only one item can be selected by the user.
  • Android spinner is like the drop down menu with multiple values from which the end user can select only one value.
  • Android spinner is associated with AdapterView. So you need to use one of the adapter classes with spinner.
  • Android Spinner class is the subclass of AsbSpinner class.

Android Spinner Example

In this example, we are going to display the country list. You need to use ArrayAdapter class to store the country list.The simple example of spinner in android.

activity_main.xml

Drag the Spinner from the pallete, now the activity_main.xml file will like this:

File: activity_main.xml

 

Activity class

Let’s write the code to display item on the spinner and perform event handling.

File: MainActivity.java

Output:

spinneroutput1 spinneroutput2

Email this to someonePrint this pageShare on Google+1Share on Facebook0Tweet about this on TwitterShare on LinkedIn0Share on Reddit0Pin on Pinterest0Share on StumbleUpon2

About Team

Browse Archived Articles by Team

Related

Sorry. There are no related articles at this time.