Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Using Kotlin in Android
Search
Ivan
May 03, 2019
Programming
120
0
Share
Using Kotlin in Android
Kotlin examples for study group in Taiwan Kotlin User Group
Ivan
May 03, 2019
More Decks by Ivan
See All by Ivan
KtRssReader 的奇幻旅程
ivanw
0
110
Kotlin Flow Application and Testing on Android
ivanw
0
320
Kotlin Flow Application and Testing on Android
ivanw
1
460
A Step-by-Step Guide to Kotlin Flow 手把手帶你認識 Kotlin Flow
ivanw
0
230
Coroutines Made Easy
ivanw
1
200
All About KotlinConf 2019
ivanw
0
130
Writing Tests in Kotlin
ivanw
0
360
Other Decks in Programming
See All in Programming
決定論 vs 確率論:Gemini 3 FlashとTF-IDFを組み合わせた「法規判定エンジン」の構築
shukob
0
170
横断組織出身のQAEがインプロセスQAEでつまずいたこと・活かせたこと
ty89
0
150
iOS26時代の新規アプリ開発
yuukiw00w
0
140
関係性から理解する"同一性"の型用語たち
pvcresin
1
210
開発とはなにか、Essenceカーネルで見えるもの
ukin0k0
0
190
書き換えて学ぶTemporal #fukts
pirosikick
2
380
Sans tests, vos agents ne sont pas fiables
nabondance
0
140
柔軟なPDFレイアウトエディタを支える型システム設計 — Discriminated UnionとConditional Typeの実践
minako__ph
1
170
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
3
1.1k
Symfony AI in Action - SymfonyLive Berlin 2026
chr_hertel
1
160
開発体験を左右するライブラリの API 設計 - GraphQL スキーマ構築ライブラリから考える #tskaigi
izumin5210
1
190
Agent Skills を社内で育てる仕組み作り
jackchuka
1
2.1k
Featured
See All Featured
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
810
HDC tutorial
michielstock
2
660
Leo the Paperboy
mayatellez
7
1.8k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.3k
Tell your own story through comics
letsgokoyo
1
920
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
70
39k
Site-Speed That Sticks
csswizardry
13
1.2k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.7k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
510
How to make the Groovebox
asonas
2
2.2k
Transcript
Using Kotlin in Android Ivan W.
Outline • Null Safety • Data Class • Default Argument
/ Implementation 2
Null Safety • Eliminate the danger of null references from
code • Nullable types and Non-Null Types var a: String = "abc" a = null // compilation error var b: String? = "abc" b = null // ok 3 Nullable types Non-Null types
Example 1 4 Bundle args = getArguments(); if (args !=
null) { Bundle data = args.getBundle(KEY_DATA); if (data != null) { Log.d(TAG, data.getString(KEY_NAME)); } } Java
Example 1 5 Bundle args = getArguments(); if (args !=
null) { Bundle data = args.getBundle(KEY_DATA); if (data != null) { Log.d(TAG, data.getString(KEY_NAME)); } } Log.d(TAG, arguments?.getBundle(KEY_DATA)?.getString(KEY_NAME)) Java Kotlin
Data Class • It automatically generates ◦ equals() / hashCode()
◦ getters and setters ◦ toString() ◦ copy()
Example 2 7 Java Kotlin See example See example
Default Argument / Implementation 8 • Java overloads can be
replaced with one function in Kotlin
Example 3 9 private void sendInfo(String content, long Time, String
tag) { /* ... */ } private void sendInfo(String content, long Time) { /* ... */ } private void sendInfo(String content, String tag) { /* ... */ } private void sendInfo(String content) { /* ... */ } Java
Example 3 10 private fun sendInfo( content: String, time: Long
= Date().time, tag: String = TAG ) { … } sendInfo("content", time = Date().time) Kotlin
Example 4 11 Java Kotlin See example See example
Thank you! 12