« All Events
5 PM – Intro To Java
September 21, 2021 @ 6:00 pm - 7:00 pm
Today We Do
- We learned how to add listener to Spinner. This way when Spinner is selected it we can do some action.
- We made MainActivity.java implements OnItemSelectedListener interface
Homework:
- When Spinner item is selected changed the sourceLabel TextView and destinationLabel TextView text. Look at how we get the UI components (sourceTextField and destinationTextField) when we click the “convert” button. You need to add a similar code when Spinner item is selected.
-
// check if selectedConversion is equal to "Celcius to Fahrenheit"
// then set the text for sourceLabel and set to "Celcius"
// check if selectedConversion is equal to "Fahrenheit to Celcius"
// then set the text for destinationLabel and set to "Fahrenheit"