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
0
110
Using Kotlin in Android
Kotlin examples for study group in Taiwan Kotlin User Group
Ivan
May 03, 2019
Tweet
Share
More Decks by Ivan
See All by Ivan
KtRssReader 的奇幻旅程
ivanw
0
94
Kotlin Flow Application and Testing on Android
ivanw
0
310
Kotlin Flow Application and Testing on Android
ivanw
1
450
A Step-by-Step Guide to Kotlin Flow 手把手帶你認識 Kotlin Flow
ivanw
0
210
Coroutines Made Easy
ivanw
1
190
All About KotlinConf 2019
ivanw
0
130
Writing Tests in Kotlin
ivanw
0
340
Other Decks in Programming
See All in Programming
CSC307 Lecture 03
javiergs
PRO
1
490
CSC307 Lecture 06
javiergs
PRO
0
680
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
6k
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
190
メルカリのリーダビリティチームが取り組む、AI時代のスケーラブルな品質文化
cloverrose
2
510
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
120
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
230
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
430
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
190
2026年 エンジニアリング自己学習法
yumechi
0
130
CSC307 Lecture 02
javiergs
PRO
1
780
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
432
66k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.5k
Testing 201, or: Great Expectations
jmmastey
46
8k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
430
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
410
Color Theory Basics | Prateek | Gurzu
gurzu
0
200
Evolving SEO for Evolving Search Engines
ryanjones
0
120
The agentic SEO stack - context over prompts
schlessera
0
630
Unsuck your backbone
ammeep
671
58k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
92
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
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