Skip to content

Beginner: Kotlin · Kotlin basics · topic 1 of 50 · 20 min

Kotlin and Android: the big picture

Explanation

Android is the operating system on most smartphones in India, and Kotlin is the language Google recommends for building Android apps. Kotlin is modern, short to write, protects you from null crashes, and works with existing Java code. In this course you first learn Kotlin itself, then build Android apps with Jetpack Compose.

What is Android?

Android is an operating system: the base software that runs a phone, like Windows runs a laptop. It is made by Google and is open source, so many brands (Samsung, Xiaomi, Vivo, OnePlus and others) use it. In India, the large majority of smartphones run Android, so an Android app can reach a very large audience, from metro cities to small towns.

What is Kotlin?

Kotlin is a programming language created by JetBrains, the company behind IntelliJ IDEA. It first became stable in 2016. In 2017 Google announced official support for Kotlin on Android, and in 2019 it declared Android development "Kotlin-first": new Android libraries, documentation and samples are written for Kotlin. Today most professional Android apps are written in Kotlin.

  • Concise: the same logic usually needs far fewer lines than in Java.
  • Null-safe: the compiler stops most "null pointer" crashes before the app runs (module 2).
  • Interoperable: Kotlin and Java code can live in the same project and call each other.
  • Modern: coroutines make slow work like network calls easy to write (module 4).
  • Multi-platform: Kotlin also runs on servers and, with Kotlin Multiplatform, can share code with iOS.
Think of it like this: Think of Android as a big shopping mall and apps as the shops inside. Kotlin is the modern construction method the mall management recommends: faster to build with, with safety checks built in. You could still build a shop the old way (Java), but most new shops use the new method.

Compiled and typed

Kotlin is a compiled language: a program called the compiler checks your code and turns it into something the device can run. It is also statically typed: every value has a type (number, text, true/false) known before the program runs, so many mistakes are caught early. You will see compiler errors often; they are your friend.

What you will build in this course

PartYou learnYou can then build
Beginner (Kotlin)Basics, null safety, functions, classes, collections, coroutinesConsole programs and clean Kotlin logic
Intermediate (Android basics)Android Studio, Compose UI, navigation, MVVM, Room, RetrofitA multi-screen app that saves data and calls an API
Expert (features and shipping)Permissions, Material 3, testing, Play Store, FirebaseA tested, published app

Tools for this module

For the Kotlin modules you do not need Android Studio yet. Use the Kotlin Playground at play.kotlinlang.org, a free website that runs Kotlin code in your browser. Later, in module 5, you will install Android Studio, the official app-building tool.

Common mistakes when starting

  • Jumping straight into Android screens without learning Kotlin. Android code is much easier once the language feels natural.
  • Learning Java first "because Android used to use it". Start with Kotlin; you can read Java later.
  • Copying old tutorials that use XML layouts and Java. They still work, but new apps use Kotlin and Jetpack Compose.

Need help?

Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.

Try:

Watch the lesson

Kotlin and Android: the big picture · 1/6

Android + Kotlin

Welcome. Android runs most smartphones in India, and Kotlin is the language Google recommends for Android apps.

Prefer a video by a teacher? Find free videos on “what is kotlin android development introduction” on YouTube ↗

In real life: One app, millions of phones

A small team in Jaipur builds a Kotlin Android app for booking local tour guides. Because most of their customers use Android phones of many brands and price levels, one Kotlin app reaches almost all of them. Kotlin's null safety means fewer crashes on the cheap phones with patchy networks that many of their users have, which shows up as better ratings on the Play Store.

kotlin
fun main() {
    val app = "GuideMe"
    val cities = 12
    println("$app works in $cities cities")
}
Prints: GuideMe works in 12 cities

Practice (0/2 done)

Task 1 · Question

Since 2019, how does Google describe Android development?

Task 2 · Practice

Open play.kotlinlang.org, run the default program, then change it to print your name and the name of an app you would like to build. Write two sentences on why Kotlin is a good choice for that app.

Quick quiz

Question 1

1.Who created Kotlin?

Question 2

2.Which is a key safety feature of Kotlin?

Question 3

3.Can Kotlin and Java code be used in the same Android project?

Question 4

4.What is the recommended modern way to build Android screens?

Read more (free)

Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.

Who created Kotlin?

Answer: JetBrains

JetBrains created Kotlin; Google adopted it for Android.

Which is a key safety feature of Kotlin?

Answer: Null safety checked by the compiler

Kotlin's type system separates values that can be null from those that cannot.

Can Kotlin and Java code be used in the same Android project?

Answer: Yes, they interoperate

Kotlin was designed to work alongside Java.

What is the recommended modern way to build Android screens?

Answer: Jetpack Compose with Kotlin

Compose is Android's recommended UI toolkit.

What runs Java bytecode?Related

Answer: The Java Virtual Machine (JVM)

Bytecode runs on the JVM.

From What Java is and where it is used

Which Google sample app demonstrates modern Android architecture?Related

Answer: Now in Android

Now in Android is open source.

From Portfolio and next steps

Which function shows Compose content in an activity?Related

Answer: setContent

setContent { } hosts the composables.

From Hello Compose: your first screen

Which skill appears in almost every modern Android job post?Related

Answer: Kotlin

Kotlin is the primary Android language.

From Android jobs in India

Pass the quiz (60% or more) or mark this topic as done when you are ready.

Your progress is saved on this device only.

Next steps

  1. 3 more topics in “Kotlin basics” before its exam: First program, val and var, and types, Conditions: if and when, Loops and ranges.
  2. Module 1 exam: Kotlin basics · 13 questions · 20 min, without help. 4 topics of this module still to finish first.
  3. Then the next module, Null safety, functions and lambdas. 50 topics left in the course before the final exam.