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)

Creating the application's settings activity

It is now the time to develop a simple application settings activity from which a user can update their profile status. Create a new package within com.example.messenger.ui named settings. Within this package, create a new settings activity. Name the activity SettingsActivity. To create a settings activity, right-click on the settings package, then select New | Activity | Settings Activity. Input the necessary details of the new settings activity, such as an activity name and activity title, then click Finish.

In the process of creating a new SettingsActivity, Android Studio will add a number of additional files to your project. In addition to this, a new .xml resource directory (app | res | xml) will be added to your project. This directory should contain the following files:

  • pref_data_sync.xml
  • pref_general.xml
  • pref_headers.xml...