SlideShare a Scribd company logo
Introduction to Android
with Kotlin
PlovDev
25 Nov 2017
• Doncho Minkov
• Principal Technical Trainer @ Telerik
Academy
• 13+ years in IT
• 7 as a trainer
• Front-end developer by heart
• Software developer by need
• Experience with all popular mobile platforms
• Android, iOS, Windows
• Fluent in Android, Node.js, Angular, Java,
C++
• Deep knowledge of Data Structures and
Algorithms
Who Am I?
Github
LinkedIn
E-mail
Introduction to Android with Kotlin:  Дончо Минков (Telerik Academy)
• The first large initiative for free IT education in Bulgaria
• Massive effect on the ecosystem since 2009:
• 12,000+ people trained on-site
• 45,000 people used the online training resources
• 25+ courses, 3,800+ video lessons with 6M views on YouTube
• For people aged 6 to 66+ years:
• Kids/youth: spark love for technology and learning in general
• Young job-seekers: get their first IT job with a flying start
• Working professionals: switch careers to the more promising IT sector
• 100% success rate of Telerik Academy graduates:
• 67% start working within 1-2 months of graduation
• The rest start working shortly after that
• Geo coverage throughout Bulgaria:
• 36 locations in 11 towns for the Telerik Kids Algo Academy
• Still just in Sofia with the other formats
• Not a substitute, but addition to the state education system:
• A bridge between the state education and the first job
• More dynamic, practical and market-oriented program
Table of Contents
• What is Android?
• What is Kotlin?
• Why Kotlin?
• Kotlin Features
What is Android?
• Android is a mobile OS
• Supported by Google
• Open-source
• Languages for developing Android apps
• Java
• C/C++
• JavaScript (React Native/NativeScript)
• C# (Xamarin)
• Now Kotlin in Android!
• Google I/O ’17
• https://www.youtube.com/watch?v=d8ALcQiuPWs
What is Kotlin?
• Kotlin is a statically-typed programming
• Developed by JetBrains
• Runs on the JVM
• Can be compiled to JavaScript
• Kotlin is interoperable with Java
• Any Java code can be used in Kotlin and vice versa
• The “fun” language
Why Kotlin? (instread of Java)
• New and shiny programming language
• First official release in 2016
• Java for Android is stuck in Java 7
• Java 8 is available only on API 24 and above
• No LAMBDAs
• No extensions (interfaces)
• No forEach(), map(), etc…
• Kotlin supports all of the above
• Kotlin has null-checks (guards)
• Very similar to Swift
Kotlin in Android
• Since Android Studio 3.X Kotlin is one of the first-class
languages to develop Android apps
• Can paste Java code and it is translated to Kotlin
• Works good enough for small files
• Kotlin works well with all current Android libs
• OkHTTP, Retrofit, ReactiveX, etc…
• Kotlin can extend Java classes and interfaces
• i.e. Kotlin implementation of a Java interface
Kotlin Features
Activities
class ListActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_list)
adapter = ArrayAdapter<String>(…)
listView = findViewById<ListView>(R.id.lv_names);
listView.adapter = adapter
}
}
Attaching Events
btn.setOnClickListener({
Toast.makeText(this, "Success!", Toast.LENGTH_LONG)
.show()
})
btn.setOnClickListener({ btn ->
Toast.makeText(this, "Success!", Toast.LENGTH_LONG)
.show()
})
Extention Methods
fun AppCompatActivity.showLoading() {
// show loader
}
fun AppCompatActivity.hideLoading() {
// show loader
}
• Now all activities have showLoading() and hideLoading()!
LAMBDAs
books.filter { it.platform == "Android" }
.map { it.name }
.forEach(adapter::add)
Null checks
• Get the value or null
view: View? = listView ?: null
• Throw expressions, throw if value is null
view: View = listView ?: throw Throwable("Null view")
• Type-safe invocation:
view?.findViewById<Button>(R.id.btn)?.visibility
• And they are done compile time
Works Well with Java libs
booksRepository.listAll()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ books ->
adapter.clear()
adapter.addAll(books.map { it.name })
})
• Example: RxAndroid
Thank you!
Find demos & slides at: https://goo.gl/kMdZBk

More Related Content

PPTX
Introduction to Kotlin
PPTX
Academy PRO: React Native - introduction
PPTX
Overview of microsoft dot net platforms
PPTX
Is kotlin better option for android app development
PDF
Managed Code .NET
PDF
Obop 210 lecture 2 python documentation
PPTX
The Pros and Cons of Kotlin Language for Android App Development
PDF
Kotlin for android development
Introduction to Kotlin
Academy PRO: React Native - introduction
Overview of microsoft dot net platforms
Is kotlin better option for android app development
Managed Code .NET
Obop 210 lecture 2 python documentation
The Pros and Cons of Kotlin Language for Android App Development
Kotlin for android development

Similar to Introduction to Android with Kotlin: Дончо Минков (Telerik Academy) (20)

PPTX
Android with kotlin course
PPTX
Android Development with Kotlin course
PDF
Kotlin for Android
PDF
Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...
PDF
Programming with Kotlin
PDF
Why You Should Go with Kotlin for Android App Development.pdf
PDF
Learn Kotlin and Build Robust Android Apps with Bcoder.pdf
PDF
Android 101 - Kotlin ( Future of Android Development)
PDF
Is this Swift for Android? A short introduction to the Kotlin language
PPTX
Kotlin – the future of android
PDF
Kotlin introduction
PPTX
Presentation on Kotlin programming Language.pptx
PPTX
PPTX
Intro to Kotlin
PPTX
Introduction to Kotlin Language and its application to Android platform
PDF
A short introduction to the Kotlin language for Java developers
PDF
Save time with kotlin in android development
PPTX
Kotlin for android 2019
PDF
Summer of Tech 2017 - Kotlin/Android bootcamp
Android with kotlin course
Android Development with Kotlin course
Kotlin for Android
Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...
Programming with Kotlin
Why You Should Go with Kotlin for Android App Development.pdf
Learn Kotlin and Build Robust Android Apps with Bcoder.pdf
Android 101 - Kotlin ( Future of Android Development)
Is this Swift for Android? A short introduction to the Kotlin language
Kotlin – the future of android
Kotlin introduction
Presentation on Kotlin programming Language.pptx
Intro to Kotlin
Introduction to Kotlin Language and its application to Android platform
A short introduction to the Kotlin language for Java developers
Save time with kotlin in android development
Kotlin for android 2019
Summer of Tech 2017 - Kotlin/Android bootcamp
Ad

More from PlovDev Conference (7)

PDF
Linux Resource Management - Мариян Маринов (Siteground)
PDF
Интернет стандартите - къде и как се създават, и защо си струва да участвам?-...
PDF
Приложение на изкуствен интелект при анализа на медийно съдържание в интернет...
PDF
DevOps in the Cloud Валентин Христев (VMWare)
PPTX
PlovDev 2016: Оркестрация на контейнери с Kubernetes - Мартин Владев
PDF
PlovDev 2016: Drupal 8 Evolution & Kickstart by Ivo Radulovski
PPTX
PlovDev 2016: Application Performance in Virtualized Environments by Todor T...
Linux Resource Management - Мариян Маринов (Siteground)
Интернет стандартите - къде и как се създават, и защо си струва да участвам?-...
Приложение на изкуствен интелект при анализа на медийно съдържание в интернет...
DevOps in the Cloud Валентин Христев (VMWare)
PlovDev 2016: Оркестрация на контейнери с Kubernetes - Мартин Владев
PlovDev 2016: Drupal 8 Evolution & Kickstart by Ivo Radulovski
PlovDev 2016: Application Performance in Virtualized Environments by Todor T...
Ad

Recently uploaded (20)

PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Spectroscopy.pptx food analysis technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Encapsulation theory and applications.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
sap open course for s4hana steps from ECC to s4
Spectroscopy.pptx food analysis technology
“AI and Expert System Decision Support & Business Intelligence Systems”
Unlocking AI with Model Context Protocol (MCP)
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Digital-Transformation-Roadmap-for-Companies.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Review of recent advances in non-invasive hemoglobin estimation
20250228 LYD VKU AI Blended-Learning.pptx
Machine learning based COVID-19 study performance prediction
Building Integrated photovoltaic BIPV_UPV.pdf
MYSQL Presentation for SQL database connectivity
A comparative analysis of optical character recognition models for extracting...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Encapsulation theory and applications.pdf

Introduction to Android with Kotlin: Дончо Минков (Telerik Academy)

  • 1. Introduction to Android with Kotlin PlovDev 25 Nov 2017
  • 2. • Doncho Minkov • Principal Technical Trainer @ Telerik Academy • 13+ years in IT • 7 as a trainer • Front-end developer by heart • Software developer by need • Experience with all popular mobile platforms • Android, iOS, Windows • Fluent in Android, Node.js, Angular, Java, C++ • Deep knowledge of Data Structures and Algorithms Who Am I? Github LinkedIn E-mail
  • 4. • The first large initiative for free IT education in Bulgaria • Massive effect on the ecosystem since 2009: • 12,000+ people trained on-site • 45,000 people used the online training resources • 25+ courses, 3,800+ video lessons with 6M views on YouTube • For people aged 6 to 66+ years: • Kids/youth: spark love for technology and learning in general • Young job-seekers: get their first IT job with a flying start • Working professionals: switch careers to the more promising IT sector • 100% success rate of Telerik Academy graduates: • 67% start working within 1-2 months of graduation • The rest start working shortly after that • Geo coverage throughout Bulgaria: • 36 locations in 11 towns for the Telerik Kids Algo Academy • Still just in Sofia with the other formats • Not a substitute, but addition to the state education system: • A bridge between the state education and the first job • More dynamic, practical and market-oriented program
  • 5. Table of Contents • What is Android? • What is Kotlin? • Why Kotlin? • Kotlin Features
  • 6. What is Android? • Android is a mobile OS • Supported by Google • Open-source • Languages for developing Android apps • Java • C/C++ • JavaScript (React Native/NativeScript) • C# (Xamarin) • Now Kotlin in Android! • Google I/O ’17 • https://www.youtube.com/watch?v=d8ALcQiuPWs
  • 7. What is Kotlin? • Kotlin is a statically-typed programming • Developed by JetBrains • Runs on the JVM • Can be compiled to JavaScript • Kotlin is interoperable with Java • Any Java code can be used in Kotlin and vice versa • The “fun” language
  • 8. Why Kotlin? (instread of Java) • New and shiny programming language • First official release in 2016 • Java for Android is stuck in Java 7 • Java 8 is available only on API 24 and above • No LAMBDAs • No extensions (interfaces) • No forEach(), map(), etc… • Kotlin supports all of the above • Kotlin has null-checks (guards) • Very similar to Swift
  • 9. Kotlin in Android • Since Android Studio 3.X Kotlin is one of the first-class languages to develop Android apps • Can paste Java code and it is translated to Kotlin • Works good enough for small files • Kotlin works well with all current Android libs • OkHTTP, Retrofit, ReactiveX, etc… • Kotlin can extend Java classes and interfaces • i.e. Kotlin implementation of a Java interface
  • 11. Activities class ListActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_list) adapter = ArrayAdapter<String>(…) listView = findViewById<ListView>(R.id.lv_names); listView.adapter = adapter } }
  • 12. Attaching Events btn.setOnClickListener({ Toast.makeText(this, "Success!", Toast.LENGTH_LONG) .show() }) btn.setOnClickListener({ btn -> Toast.makeText(this, "Success!", Toast.LENGTH_LONG) .show() })
  • 13. Extention Methods fun AppCompatActivity.showLoading() { // show loader } fun AppCompatActivity.hideLoading() { // show loader } • Now all activities have showLoading() and hideLoading()!
  • 14. LAMBDAs books.filter { it.platform == "Android" } .map { it.name } .forEach(adapter::add)
  • 15. Null checks • Get the value or null view: View? = listView ?: null • Throw expressions, throw if value is null view: View = listView ?: throw Throwable("Null view") • Type-safe invocation: view?.findViewById<Button>(R.id.btn)?.visibility • And they are done compile time
  • 16. Works Well with Java libs booksRepository.listAll() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe({ books -> adapter.clear() adapter.addAll(books.map { it.name }) }) • Example: RxAndroid
  • 17. Thank you! Find demos & slides at: https://goo.gl/kMdZBk