- This event has passed.
4 PM – Intro To Java – William
April 6 @ 4:00 pm - 5:00 pm
Today We Did
- Added 3 conversion types to the application
- Created ConversionTypeListener.java to listen to changes in the Spinner
Homework
Continue working on TemperatureConverter:
- Catch up if you haven’t already!! Our code can be found here: https://drive.google.com/drive/folders/1Ftsx-CYnRf3_zP2ypCEGCDhjrX3PCWrY?usp=drive_link
- Start working on code to switch labels when selecting a new conversion:
- Create a new attribute in
MainActivity.java
calledselectedConversion
and initialize it toNULL
- Create a new method called
setConversion()
insideMainActivity.java
that has one String parameter calledselectedConversion
- Inside
setConversion()
, get the 2 labels representing the two temperature units (hint: use findViewById) - Update the values of the labels using
{label}.setText({text})
based on the conversionType - Inside
ConversionTypeListener.java
, call thesetConversion()
method with selected conversion type inside theonItemSelected()
method.
- Create a new attribute in
If you have any questions, please email me at williamsmith@ayclogic.com.