Book Image

Kotlin Programming By Example

By : Iyanu Adelekan
Book Image

Kotlin Programming By Example

By: Iyanu Adelekan

Overview of this book

Kotlin greatly reduces the verbosity of source code. With Google having announced their support for Kotlin as a first-class language for writing Android apps, now's the time learn how to create apps from scratch with Kotlin Kotlin Programming By Example takes you through the building blocks of Kotlin, such as functions and classes. You’ll explore various features of Kotlin by building three applications of varying complexity. For a quick start to Android development, we look at building a classic game, Tetris, and elaborate on object-oriented programming in Kotlin. Our next application will be a messenger app, a level up in terms of complexity. Before moving onto the third app, we take a look at data persistent methods, helping us learn about the storage and retrieval of useful applications. Our final app is a place reviewer: a web application that will make use of the Google Maps API and Place Picker. By the end of this book, you will have gained experience of of creating and deploying Android applications using Kotlin.
Table of Contents (12 chapters)

Working with a SQLite database

SQLite is a popular relational database management system (RDBMS) that, unlike many RDBMS systems, is not a client-server database engine. Instead, a SQLite database is embedded directly into an application.

Android provides full support for SQLite. SQLite databases are accessible throughout an Android project by classes. Note that in Android, a database is only accessible to the application that created it.

The use of the Room persistence library is the recommended method of working with SQLite in Android. The first step to work with room in Android is the inclusion of its necessary dependencies in a project's build.gradle script:

implementation "android.arch.persistence.room:runtime:1.0.0-alpha9-1"
implementation "android.arch.persistence.room:rxjava2:1.0.0-alpha9-1"
implementation "io.reactivex.rxjava2:rxandroid:2...