Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Sometimes you want to limit the choices available for users to type. For instance, if users are going to enter the name of a state, you might as well limit them to only the valid states because this is a known set. Although you could do this by letting them type something and then blocking invalid entries, you can also provide similar functionality with a Spinner control. As with the auto-complete method, the possible choices for a spinner can come from an Adapter. You can also set the available choices in the layout definition by using the entries attribute with an array resource (specifically a string-array that is referenced as something such as @array/state-list). The Spinner control isn’t actually an EditText; although, it is frequently used in a similar fashion. Following is an example of the XML layout definition for a Spinner control for choosing a color: