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.…
Author
Updated
6/29/2018Released
7/14/2017Skill Level Intermediate
Duration
Views
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.
Related Courses
-
Introduction
-
Welcome43s
-
-
1. Android Development Tips Weekly
-
Play sounds with SoundPool8m 45s
-
Manage menus with when3m 44s
- 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.
CancelTake 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.
Share this video
Embed this video
Video: Create Room DAO classes in Kotlin