To Lecture Notes

IT 372 -- Jun 3, 2026

Review Exercises

  1. What are the required parameters for these composables?
    Text  Button  TextField  RadioButton  Canvas  Column  
    
    Answer: required parameters are marked with *, trailing lambda parameters are marked with ^. Every composable has modifier as a required parameter.
    Text    text* : String , fontSize : TextUnit , 
            fontStyle : FontStyle , fontWeight : FontWeight
    
    Button  onClick* : ( ) -> Unit ,  content*^ : ( ) -> Unit 
    
    TextField  value* : String , onValueChange* : (String) -> Unit ,
               label : ( ) -> Unit , placeholder : ( ) -> Unit
            
    RadioButton  selected* : Boolean , onClick* : ( ) -> Unit ,
                 enabled : Boolean
    
    CheckBox  checked* : Boolean , onCheckedChanged* : (Boolean) -> Unit ,
              enabled : Boolean
    
    Canvas    onDraw*^ : DrawScope.( ) -> Unit
    
    Column    content*^ : ( ) -> Unit
    
  2. Find the mistakes in this source code for a TwoWayTempConverter app:
          MainActivity.kt (with errows)   Answer: Corrected MainActivity.kt
  3. Try out the drawOval method in a Canvas element. Use these parameters:
    color : Color
    topLeft : Offset(x : Float, y : Float)
    size : Size(width : Float, height : Float)
    style : Fill or Stroke(Float)
    
    Answer: MainActivity.kt
  4. Define a CustomButton composable to use for three Button elements.
    Answer: MainActivity.kt

JetPack Compose Examples

Android Platform

We did not discuss this section in class.