May 2022
Intermediate to advanced
688 pages
20h 12m
English
In the project tool window, right-click the com.bignerdranch.android.criminalintent package and select New → Kotlin Class/File. Name the file Crime and, since this class will be used to store data, make it a Data Class.
For this project, an instance of Crime will represent a single office crime. To begin with, a Crime will have four properties:
an ID to uniquely identify the instance
a descriptive title, like “Toxic sink dump” or “Someone stole my yogurt!”
a date
a Boolean indication of whether the crime has been solved
In Crime.kt, add these four properties to Crime’s constructor.
Listing 9.2 Adding the Crime data class (Crime.kt)
data class Crime(
val id: UUID,
val title: String, ...Read now
Unlock full access