

Create an ArrayAdapter using the string array and a default spinner layout Val spinner: Spinner = findViewById(R.id.spinner) With an array such as this one, you can use the following code in your Activity or Fragment to supply the spinner with the array using Them with a string array defined in a string The choices you provide for the spinner can come from any source, but must be provided throughĪn SpinnerAdapter, such as an ArrayAdapter if theĬhoices are available in an array or a CursorAdapter if the choices areįor instance, if the available choices for your spinner are pre-determined, you can provide To populate the spinner with a list of choices, you then need to specify a SpinnerAdapter in your Activity or Fragment Should usually do so in your XML layout with a element.

You can add a spinner to your layout with the Spinner object. Touching the spinner displays a dropdown menu with all otherĪvailable values, from which the user can select a new one. Spinners provide a quick way to select one value from a set.
