Chapter 5Persist Game Data with Room

So far in this book, we’ve built a fine Penny Drop app. You’ve learned about Android views, navigation, ViewModel classes, and how they all fit together. The last main piece we need to add is some kind of persistence so our game keeps track of what players have done.

Database interaction with SQLite in Android apps has traditionally been...unpleasant. It took a great deal of work to create a database, there was no query validation, and you had to manually convert data from a Cursor class into your Java or Kotlin objects. Thankfully, a core piece of Jetpack is the introduction of Room, a persistance library created on top of SQLite. You’re able to do all the things you could before with on-device databases, ...

Get Kotlin and Android Development featuring Jetpack now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.