Android Studio 3 includes complete support for programming with Kotlin. In previous tips, you learn about how to create simple classes in Kotlin. Now learn about how to create entity classes for the Room persistence library in Kotlin.
- [Instructor] Android Studio 3 includes complete support…for programming with Kotlin.…I've described how to create simple classes in Kotlin…in previous tips.…Now I'll show you how to create entity classes…for the Room persistence library in Kotlin.…In the database definition for this application,…my Entity class for the notes table…is declared in this Java class.…The name of the class is Note.…And it has an Entity annotation…that sets the table name as notes.…It has three fields that represent the columns in the table:…an integer named noteId, that's the primary key,…a noteDate value, and a string value.…
There's a no arguments constructor method…that's required by Room,…a constructor method I can use…to create a new instance of the class easily,…getters and setters for each of the fields,…and a custom ToString method for debugging.…Now I'm going to create a Kotlin version of that class.…I'll go to my model package…and create a new Kotlin file or class.…I'll name it NoteKt, for Kotlin.…And I'll set the kind as Class.…
Skill Level Intermediate
Q: Why can't I earn a Certificate of Completion for this course?
A: We publish a new tutorial or tutorials for this course on a regular basis. We are unable to offer a Certificate of Completion because it is an ever-evolving course that is not designed to be completed. Check back often for new movies.
Building Android Apps with Cloud Serviceswith Albert Lo2h 37m Intermediate
Android App Development: Data Persistence Librarieswith Annyce Davis4h 52m Intermediate
New This Week:
1. Android Development Tips Weekly
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.