SlideShare a Scribd company logo
1 of 17
Download to read offline
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
• 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

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

Android Development with Kotlin course
Android Development  with Kotlin courseAndroid Development  with Kotlin course
Android Development with Kotlin courseGoogleDevelopersLeba
 
Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...
Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...
Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...mCloud
 
Learn Kotlin and Build Robust Android Apps with Bcoder.pdf
Learn Kotlin and Build Robust Android Apps with Bcoder.pdfLearn Kotlin and Build Robust Android Apps with Bcoder.pdf
Learn Kotlin and Build Robust Android Apps with Bcoder.pdfBcoder Dev
 
Desenvolvimento moderno de aplicativos android
Desenvolvimento moderno de aplicativos androidDesenvolvimento moderno de aplicativos android
Desenvolvimento moderno de aplicativos androidDiego Figueredo
 
KOTLIN VS. JAVA WHICH ONE IS BEST FOR ANDROID DEVELOPMENT.pptx
KOTLIN VS. JAVA WHICH ONE IS BEST FOR ANDROID DEVELOPMENT.pptxKOTLIN VS. JAVA WHICH ONE IS BEST FOR ANDROID DEVELOPMENT.pptx
KOTLIN VS. JAVA WHICH ONE IS BEST FOR ANDROID DEVELOPMENT.pptxShantanuApurva1
 
Android is a mobile operating system developed by Google, known for its open-...
Android is a mobile operating system developed by Google, known for its open-...Android is a mobile operating system developed by Google, known for its open-...
Android is a mobile operating system developed by Google, known for its open-...AshishChanchal1
 
What is Kotlin Multiplaform? Why & How?
What is Kotlin Multiplaform? Why & How? What is Kotlin Multiplaform? Why & How?
What is Kotlin Multiplaform? Why & How? Shady Selim
 
Grokking TechTalk #26: Kotlin, Understand the Magic
Grokking TechTalk #26: Kotlin, Understand the MagicGrokking TechTalk #26: Kotlin, Understand the Magic
Grokking TechTalk #26: Kotlin, Understand the MagicGrokking VN
 
How we build project for Open Source
How we build project for Open SourceHow we build project for Open Source
How we build project for Open SourceAlexander Zayats
 
Cross platform-mobile-development-course-intro
Cross platform-mobile-development-course-introCross platform-mobile-development-course-intro
Cross platform-mobile-development-course-introDoncho Minkov
 
MOE: Cross Platform Mobile Apps in Java
MOE: Cross Platform Mobile Apps in JavaMOE: Cross Platform Mobile Apps in Java
MOE: Cross Platform Mobile Apps in JavaGergely Kis
 
Why You Should Go with Kotlin for Android App Development.pdf
Why You Should Go with Kotlin for Android App Development.pdfWhy You Should Go with Kotlin for Android App Development.pdf
Why You Should Go with Kotlin for Android App Development.pdfRipenApps
 
Post Windows Mobile: New Application Development Platforms
Post Windows Mobile: New Application Development PlatformsPost Windows Mobile: New Application Development Platforms
Post Windows Mobile: New Application Development PlatformsBarcoding, Inc.
 
Ceylon From Here to Infinity: The Big Picture and What's Coming
Ceylon From Here to Infinity: The Big Picture and What's Coming Ceylon From Here to Infinity: The Big Picture and What's Coming
Ceylon From Here to Infinity: The Big Picture and What's Coming Virtual JBoss User Group
 
Native apps made easy with Xamarin and cross-platform C#
Native apps made easy with Xamarin and cross-platform C#Native apps made easy with Xamarin and cross-platform C#
Native apps made easy with Xamarin and cross-platform C#jivkopetiov
 
Kotlin native for iOS and Android
Kotlin native for iOS and AndroidKotlin native for iOS and Android
Kotlin native for iOS and AndroidShady Selim
 
Why Use Kotlin for Android App Development-Here’s a Guide.pdf
Why Use Kotlin for Android App Development-Here’s a Guide.pdfWhy Use Kotlin for Android App Development-Here’s a Guide.pdf
Why Use Kotlin for Android App Development-Here’s a Guide.pdfTechugo
 

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

Android Development with Kotlin course
Android Development  with Kotlin courseAndroid Development  with Kotlin course
Android Development with Kotlin course
 
Android with kotlin course
Android with kotlin courseAndroid with kotlin course
Android with kotlin course
 
Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...
Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...
Developers’ mDay u Banjoj Luci - Duško Bajić, Kotlin User Group Bosnia – Kotl...
 
Learn Kotlin and Build Robust Android Apps with Bcoder.pdf
Learn Kotlin and Build Robust Android Apps with Bcoder.pdfLearn Kotlin and Build Robust Android Apps with Bcoder.pdf
Learn Kotlin and Build Robust Android Apps with Bcoder.pdf
 
Desenvolvimento moderno de aplicativos android
Desenvolvimento moderno de aplicativos androidDesenvolvimento moderno de aplicativos android
Desenvolvimento moderno de aplicativos android
 
KOTLIN VS. JAVA WHICH ONE IS BEST FOR ANDROID DEVELOPMENT.pptx
KOTLIN VS. JAVA WHICH ONE IS BEST FOR ANDROID DEVELOPMENT.pptxKOTLIN VS. JAVA WHICH ONE IS BEST FOR ANDROID DEVELOPMENT.pptx
KOTLIN VS. JAVA WHICH ONE IS BEST FOR ANDROID DEVELOPMENT.pptx
 
Android is a mobile operating system developed by Google, known for its open-...
Android is a mobile operating system developed by Google, known for its open-...Android is a mobile operating system developed by Google, known for its open-...
Android is a mobile operating system developed by Google, known for its open-...
 
What is Kotlin Multiplaform? Why & How?
What is Kotlin Multiplaform? Why & How? What is Kotlin Multiplaform? Why & How?
What is Kotlin Multiplaform? Why & How?
 
Grokking TechTalk #26: Kotlin, Understand the Magic
Grokking TechTalk #26: Kotlin, Understand the MagicGrokking TechTalk #26: Kotlin, Understand the Magic
Grokking TechTalk #26: Kotlin, Understand the Magic
 
Why Kotlin?
Why Kotlin?Why Kotlin?
Why Kotlin?
 
How we build project for Open Source
How we build project for Open SourceHow we build project for Open Source
How we build project for Open Source
 
Cross platform-mobile-development-course-intro
Cross platform-mobile-development-course-introCross platform-mobile-development-course-intro
Cross platform-mobile-development-course-intro
 
MOE: Cross Platform Mobile Apps in Java
MOE: Cross Platform Mobile Apps in JavaMOE: Cross Platform Mobile Apps in Java
MOE: Cross Platform Mobile Apps in Java
 
Why You Should Go with Kotlin for Android App Development.pdf
Why You Should Go with Kotlin for Android App Development.pdfWhy You Should Go with Kotlin for Android App Development.pdf
Why You Should Go with Kotlin for Android App Development.pdf
 
Post Windows Mobile: New Application Development Platforms
Post Windows Mobile: New Application Development PlatformsPost Windows Mobile: New Application Development Platforms
Post Windows Mobile: New Application Development Platforms
 
Resume_RECENT
Resume_RECENTResume_RECENT
Resume_RECENT
 
Ceylon From Here to Infinity: The Big Picture and What's Coming
Ceylon From Here to Infinity: The Big Picture and What's Coming Ceylon From Here to Infinity: The Big Picture and What's Coming
Ceylon From Here to Infinity: The Big Picture and What's Coming
 
Native apps made easy with Xamarin and cross-platform C#
Native apps made easy with Xamarin and cross-platform C#Native apps made easy with Xamarin and cross-platform C#
Native apps made easy with Xamarin and cross-platform C#
 
Kotlin native for iOS and Android
Kotlin native for iOS and AndroidKotlin native for iOS and Android
Kotlin native for iOS and Android
 
Why Use Kotlin for Android App Development-Here’s a Guide.pdf
Why Use Kotlin for Android App Development-Here’s a Guide.pdfWhy Use Kotlin for Android App Development-Here’s a Guide.pdf
Why Use Kotlin for Android App Development-Here’s a Guide.pdf
 

More from PlovDev Conference

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

More from PlovDev Conference (7)

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

Recently uploaded

Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireExakis Nelite
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfdanishmna97
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهMohamed Sweelam
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingScyllaDB
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityVictorSzoltysek
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceSamy Fodil
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimaginedpanagenda
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuidePixlogix Infotech
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGDSC PJATK
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentationyogeshlabana357357
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...FIDO Alliance
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...ScyllaDB
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewDianaGray10
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch TuesdayIvanti
 

Recently uploaded (20)

Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهله
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 

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
  • 3.
  • 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