To Lecture Notes

IT 372 -- Mar 30, 2026

Course Documents

Course Prerequisites

Course References

Course Topics

  1. Brief History of Mobile Computing
  2. Review of Java
  3. Java vs. Kotlin
  4. Android Studio
  5. Activities
  6. XML files
  7. LinearLayout
  8. View-based Apps vs. JetPack Compose
  9. The Activity Lifecycle
  10. Intents and Multiactivity apps
  11. Widgits: toggle button, switch, radio button, spinner, scroll view, toast, image view
  12. Overview of Kotlin
  13. JetPack Compose
  14. Other Topics

Brief History of Mobile Computing

Android API Versions

Android Development

Java Review and Kotlin Intro Quiz

Start reading this Kotlin Intro document to learn about Kotlin.
For each question, give the answer in Java and Kotlin.

  1. What is the size in bytes of each of these datatypes?
    int  double  char  boolean
    
    Ans: 4; 8; 2; 1. The reason that a char variable take up two bytes it that is uses Unicode characters, which in Java take up two bytes. A boolean variable should only take up one bit, but a byte is the smallest addressable unit on a computer, so a boolean variable must take up one byte.

    Whereas in the Java language int, double, char, and boolean are primitive datatypes, in the Kotlin language, all datatypes are classes, which means that the value of a Kotlin variable is always an 8-byte reference variable which points to an object that contains variable's value. The Kotlin datatypes that correspond to int, double, char, and boolean are Int, Double, Char, Boolean.

    Here is how you declare Kotlin variables and print their values:
    var n : Int = 385;
    var x : Double = 3.14159;
    var c : Char = 'A';
    var s : String = "abc";
    println("$n $x $c $s")
    
    Variables can also be declared using duck typing (if it looks like a duck and quacks like a duck, it's a duck). This means that the variable type is inferred by the value assigned to it.
    var n = 385;
    var x = 3.14159;
    var c = 'A';
    var s = "abc";
    println("$n $x $c $s")
    
    
  2. Write a for loop that prints the odd numbers from 99 to 1 in descending order. Answer:
    // Java version:
    for (int n = 99; n >= 1; n -= 2) {
        System.out.println(n);
    }
    
    // Kotlin version:
    for (n = 00 downto 1 step 2) {
        println(n)
    }
    
  3. How does a switch statement work? Show how to translate this else..if statement into a switch statement:
    String word;
    if (n == 1) {
        word = "one";
    }
    else if (n == 2) {
        word = "two";
    }
    else {
        word = "many";
    }
    
    Answer:
    // Java version:
    String word = "";
    switch(n) {
        case 1:  word = "one";   break;
        case 2:  word = "two";   break;
        default: word = "many";
    }
    
    // Kotlin verson:
    var word = when(n) {
        1 -> "one"
        2 -> "two"
        else -> "many"
    }
    
  4. What is the difference between a static method and an instance method?
    Answer: a static method is called by a class, but an instance method is called by an object. Kotlin implements static methods by placing them in a companion object of a class.

Create a First Android App

Android Studio Folder Structure

Project 1