From the course: Building an Android App with Jetpack Libraries

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Create a data entity class

Create a data entity class - Android Tutorial

From the course: Building an Android App with Jetpack Libraries

Start my 1-month free trial

Create a data entity class

- [Instructor] So far I've been working on how to display my data. But now I need to represent the data internally in memory. And for that I'll need a data class. First I'm going to create a new package where I'll place the class. I'll go to my base package under the Java directory and select new package, and I'll create a new data package. Then I'll right click on that package and I'll create a new Kotlin file. I'll set the name as note entity and I'll set this as a class. I'll add data to the beginning of this declaration. And that means that the class is going to have some properties. Then I'll get rid of these braces, and instead put in a pair of parentheses. And within the parentheses, I'll declare the properties of the class. First, there will be an ID and that will be an integer. Then I'll have a date. And that will be a Java date object. When you select this for importing, make sure you choose date from…

Contents