Android Studio 3 includes complete support for programming with Kotlin. In this tip, learn about how to create Data Access Object (DAO) classes for the Room persistence library in Kotlin.
- [Instructor] In last week's tips…I described how to start using Kotlin…to work with the Room Persistence Library.…I created a Kotlin class that would serve as the entity…that is a table definition for Room.…These columns are translated into the columns…in an SQLite table on the device.…This week I'll show you how to do that same thing…for the data access object.…That's the DAO class that defines all of the operations…you're going to run with your database.…Just as in Java, this will be an interface in Kotlin.…
I'll right click on the database package,…and create a new Kotlin file or class.…I'll name it NotesDaoKt, for Kotlin.…I'll set the kind to Interface, and click OK.…This code is going to look very similar to the Java version.…As I did last week with the entity class,…I'll do a lot of copying and pasting.…I'll go get the DAO annotation,…and I'll paste it here above the interface.…When I'm prompted to convert to Kotlin code, I'll click Yes.…
When I'm prompted to add the import for the annotation,…I'll click OK.…
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.
Android App Development: Communicating with the Userwith Joe Marini1h 12m Intermediate
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.