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
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
120
Kotlin Flow Application and Testing on Android
ivanw
0
330
Kotlin Flow Application and Testing on Android
ivanw
1
470
A Step-by-Step Guide to Kotlin Flow 手把手帶你認識 Kotlin Flow
ivanw
0
240
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
さぁV100、メモリをお食べ・・・
nilpe
0
150
AI 輔助遺留系統現代化的經驗分享
jame2408
1
760
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
200
スマートグラスで並列バイブコーディング
hyshu
0
160
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
270
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
570
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
550
RTSPクライアントを自作してみた話
simotin13
0
610
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
840
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
260
技術記事、AIに書かせるか、自分で書くか? 〜それでも私が自分の手で書く理由〜 / #QiitaConference
jnchito
2
1.4k
Performance Engineering for Everyone
elenatanasoiu
0
180
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Leo the Paperboy
mayatellez
7
1.8k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
How GitHub (no longer) Works
holman
316
150k
Building AI with AI
inesmontani
PRO
1
1.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
GraphQLとの向き合い方2022年版
quramy
50
15k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
360
Site-Speed That Sticks
csswizardry
13
1.2k
Mobile First: as difficult as doing things right
swwweet
225
10k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
290
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.9k
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