Mobile App Development 2021W Lecture 20
Video
Video from the lecture given on March 29, 2021 may be corrupted. If the video is successfully converted it will be posted here.
Notes
Lecture 20 ---------- * Tutorial 8 is finally posted - will be finalized this afternoon * Tutorial 9 will come out by next Monday * Assignment 4 will be due still on April 12 - will come out this week, hopefully by Wednesday - will give away answers in class * No Tutorial 10 (schedule will be updated) * Final exam on April 23, 2 PM - same format as the midterm, just 2 hours instead of 80 min * Solutions for A3 will be posted on Wednesday - turn in by Tuesday night if you haven't already Kotlin is a bit funny about numbers - it does NO automatic conversions - a number with no decimals is an Int - a number with decimals is a Double - but then, how do you write a Float as a constant? - append with an F Floats vs Doubles - floats use 4 bytes, doubles use 8 bytes - so, doubles allow for much greater precision - larger exponent and mantissa - both are binary representations of numbers in scientific notation Android intents & activities go together - intents are messages to an app to do something - activities are screens that can be displayed in response to intents - an intent doesn't have to cause a screen to be displayed, but if you want to display a new screen (including the first one), it will start with an intent - so, to switch screens we generate and receive intents - also, to call outside apps, we send intents Intents have two kinds: explicit and implicit - explicit specifies exactly what to do - implicit allows the receiver to interpret, may even be receivable by multiple apps
Code
Below is the layout created during class. The app was just the default Kotlin hello world (empty activity).
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/valueLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="33dp"
android:layout_marginBottom="215dp"
android:text="Value"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/value" />
<EditText
android:id="@+id/value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="74dp"
android:ems="8"
android:inputType="numberDecimal"
app:layout_constraintBaseline_toBaselineOf="@+id/valueLabel"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>