From the course: Android Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Build Kotlin classes with properties

Build Kotlin classes with properties - Android Tutorial

From the course: Android Development Tips

Build Kotlin classes with properties

- [Instructor] In a previous tip, I've described how to convert some of your Java classes to Kotlin, the new programming language from JetBrains that's now fully supported in Android. In this tip, I'll show you how to replace plain old Java object, or POJO classes, with what Kotlin calls data classes. That is, classes that are simply used to store data in memory. Now I'm working in Android Studio 2.3. If you're working in Android Studio 3 or later, some of these steps might look a little bit different, but you'll still be using the same language and that's the focus of this tip. In my project, I'm going to create a new package. I'll place this under the base package, and I'll name it Model. Than I'll right-click on the new package and select New, Kotlin File or Class. I'll name my class Person, and I'll set the kind of file I'm creating to Class, and click OK. Now I'll add this to Git so I can check it in easily, and I see a prompt that tells me that Kotlin isn't configured. Now this…

Contents