Unit - 3 Spinner Controls


Lesson Plan: Unit - 03
Subject: P15A2AAD - Android Application Development
Topic of Study: Displaying Text with Spinner Control
Grade/Level: Master of Computer Applications
Objective: To understand the Spinner and its properties
Time Allotment: 55 Minutes


  • Giving Users input choice using Spinner Control
    • You want to limit the choices available for users to type. 
      • Exa. if users are going to enter the name of a state.
      • 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
    • The Spinner control isn’t actually an EditText.
    • Exa. Step 01

    • Exa. Step 02

    • Because the Spinner control is not a TextView, but a list of TextView objects, you can’t directly request the selected text from it. 
    • Instead, you have to retrieve the selected View and extract the text directly:
    • Exa.
    • Exa. Step 03 (Sample code of .Java file)

Thanks a lot for query or your valuable suggestions related to the topic.

Previous Post Next Post

Contact Form