Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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
140
Kotlin Flow Application and Testing on Android
ivanw
0
340
Kotlin Flow Application and Testing on Android
ivanw
1
470
A Step-by-Step Guide to Kotlin Flow 手把手帶你認識 Kotlin Flow
ivanw
0
270
Coroutines Made Easy
ivanw
1
210
All About KotlinConf 2019
ivanw
0
140
Writing Tests in Kotlin
ivanw
0
360
Other Decks in Programming
See All in Programming
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
330
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
520
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
330
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
270
Workers Cache を知る
syumai
0
320
AgentCore CLI で進化した AWS での AI エージェントの作り方 : 必要な機能を必要な時に
icoxfog417
PRO
4
410
JPUG勉強会 OSSデータベースの内部構造を理解しよう(第2回)
oga5
0
290
AGENTS.md Is Not Enough:Build Skills, Don't Download Them
lx_t
0
130
ゲームコントローラやキーボードのファームウェアをSwiftで書く
kishikawakatsumi
1
270
mrbgem 三角測量 開発
ogom
0
180
速習iPhone Duo対応
yuukiw00w
2
930
AWSに止められる覚悟してますか?
morizo_1984
2
500
Featured
See All Featured
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
310
The Curse of the Amulet
leimatthew05
3
15k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.3k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
250
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Mind Mapping
helmedeiros
1
390
First, design no harm
axbom
PRO
2
1.3k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
730
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