Spinner in Android Studio
Sandip Bhattacharya Sandip Bhattacharya
10.2K subscribers
17,645 views
140

 Published On Jun 1, 2020

Master programming and take your career to new heights with clear, concise C, Android, and Web Development courses for just Rs. 999 / $ 12. Get lifetime access and certificate. Click here to enroll: https://courses.sandipbhattacharya.co...

Hi, in this video, I'll demonstrate how to work with Spinner in Android. I'll show you step-by-step, how to do the following:

1. Add a spinner in XML and load the list of items with a string array defined in a string resource file. If the available choices for your spinner are pre-determined it's the best way to do it.
2. Add another spinner in XML and load the items dynamically using ArrayList and ArrayAdapter.
3. Add a normal button and set a click listener on that, when clicked on this button it displays selected values of the two Spinners as a Toast message.
4. Set OnItemSelectedListener on both the Spinners to handle the OnItemSelected event which is triggered when the user selects an item.

Let's get started.

What is Spinner?
Android spinner is used to quickly select one item or value from a list of items or set. It is just a drop-down list seen in other programming languages. For example, Android Spinner is just like a combo box of AWT or Swing. It's very much similar to the HTML select tag. Android spinner is associated with an Adapter. So you need to use one of the Adapter classes with spinner. The values for the spinner can come from any source like Array or ArrayList or SQLite database but must be provided through a SpinnerAdapter, such as an ArrayAdapter or CursorAdapter, etc. You can also create your own custom Adapter by extending ArrayAdapter or BaseAdapter for a more complex design that fits your needs. Android Spinner class is the subclass of AbsSpinner class.

Source Code for this video
https://github.com/sandipapps/Simple-...

| -------------------------------------------------------------------- |

đź‘Ť Subscribe to the Channel
https://www.youtube.com/c/SandipBhatt...

Check out other Playlists

â–ş Introduction to Programming with C (2 hours of video content)
   • C Programming Tutorial for Beginners  

â–ş Android App Development for Beginners (8+ hours of video content)
   • Android Apps and Games Development fo...  

â–ş Build a Complete Quiz App for Android
   • Build a Complete Quiz App for Android  

â–ş Android SQLite Programming for Beginners (2.5 hours of video content)
   • Android SQLite Programming for Beginners  

â–ş Android Game Development in Android Studio: Build Games for Absolute Beginners (3+ hours of video content)
   • Android Game Development in Android S...  

â–ş Android Game Development - Create Your First Mobile Game
   • Android Game Development - Create You...  

â–ş Android Game Development Tutorial
   • Android Game Development Tutorial  

â–ş Programming Flappy Bird for Android
   • Programming Flappy Bird for Android  

â–ş Object Oriented Programming Fundamentals
   • Object Oriented Programming Fundamentals  

â–ş jQuery for Beginner to Advanced
   • jQuery for Beginner to Advanced  

â–ş PHP MySQL CRUD Tutorial (Create, Read, Update, Delete) (1+ hour of video content)
   • PHP MySQL CRUD Tutorial (Create, Read...  

❤️ You can donate by clicking here
PayPal: https://paypal.me/CreatorSandip
For Indians: https://www.instamojo.com/@CreatorSandip

✉️ For Business Inquiries
[email protected]

đź“Ł Follow me on other sites
→ Website: https://SandipBhattacharya.com
→ Udemy: http://bit.ly/SandipUdemy
→ Skillshare: http://bit.ly/SandipSkillshare
→ Google Play: http://bit.ly/SandipPlay
→ Facebook Page: http://bit.ly/SandipFacebook
→ Facebook Group: https://bit.ly/PWSGroup
→ LinkedIn Group: https://bit.ly/PWSGroupLI
→ Twitter: http://bit.ly/SandipTwitter
→ GitHub: http://bit.ly/SandipGitHub

show more

Share/Embed