Rajat Talesra gave a presentation on using Kotlin for Android development. He began with introducing himself and his background. He then discussed what Kotlin is, its advantages over Java like null safety and higher-order functions. Some issues with Java like nullability were also covered. The presentation included how to set up a Kotlin environment in Android Studio and examples of Kotlin code for Android apps, including functions, nullability, and resources for learning more.
2. Who am I?
RajatTalesra
FounderWiseL – Edu-tech startup
Android Developer
Google Facilitator
ICT Engineer
Rajat Talesra | www.wisel.in
3. About KOTLIN
Statically typed programming language
for modern multiplatform applications
Developed by JetBrains (Creator of Intellij)
Rajat Talesra | www.wisel.in
6. Issues with
Java?
No higher functions
No lambda support
Nullability Problem
Mutability Problem
Rajat Talesra | www.wisel.in
7. Advantages of
KOTLIN
Higher functions: Function in function
Lambda support
Nullability issue resolved
Immutable
100% interoperable with JAVA
Improves heath and performance of the app
… but adds approx 885KB to app size
Rajat Talesra | www.wisel.in
8. Starters
Enable Kotlin Plugin
Ctrl + Shift + A -> Search Plugins -> Install JetBrains Plugins -> Kotlin
Convert Java File to Kotlin
Ctrl + Shift + A -> Convert Java File to Kotlin
Configure Kotlin in Project
Ctrl + Shift + A -> Configure
Rajat Talesra | www.wisel.in
12. Nullability
By default, Kotlin assumes that value cannot be null:
If we want to create a nullable reference, we need to create
append the question mark(?) to the type definition:
When we want to access the b reference, we must handle the null
case explicitly to avoid a compilation error because Kotlin knows
that this variable can hold null
Rajat Talesra | www.wisel.in
13. Other
methods
let() :To execute an action only when a reference holds a non-
nullable value, we can use a let operator.
also() : to apply some additional operation, for example logging
on every non-nullable value we can use an also()
Rajat Talesra | www.wisel.in