kotlin programming language for android projects

SanaMateen7 1 views 17 slides Oct 12, 2025
Slide 1
Slide 1 of 17
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17

About This Presentation

kotlin basics


Slide Content

Kotlin By Sana Mateen

Kotlin It is a modern, statically typed programming language used for android development. It is made by JetBrains. It is object oriented and functional language. 100% Interoperable with Java(Java code can call Kotlin and vice versa). It is Open Source. It is concise, safe and powerful.

History February 15, 2016: Kotlin 1.0 was released . January 04, 2017: Spring introduced Kotlin support in Spring 5. At Google I/O 2017 , Google announced first-class support for Kotlin on Android. On 7 May 2019, Google announced that Kotlin the preferred language for Android app developers. June 2022: Kotlin 1.7 was released with the version of the new K2 compiler

Core Kotlin Instead of println we use Log.d () or update a TextView We Won’t use main() in Android

Variables Kotlin has immutable ( val ) and mutable (var) variables. val → read-only (like final in Java) var → can be reassigned Android use val button= findViewById <Button> R.id.btnClick button.text =“Click Me”

DataTypes There are the following different types of primitive data types in Kotlin: Boolean Byte Char Double Float Int Long Short

Boolean In Kotlin, Boolean can hold either true or false. To declare a boolean variable, the var or val keyword can be used , followed by the variable name, and the assigned boolean value: val isTrue : Boolean = true val isFalse : Boolean = false A boolean can be used to determine the outcome of if...else statements:

fun main(){ val condition: Boolean = true if (condition) { // Code that gets executed if the variable is true } else { // Code that gets executed if the variable is false } } Sometimes you specify the type manually:

Program

Output

Program

Program

Output