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
130
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
AI時代に学ぶ 好きなルール 嫌いなルール Linter編
shorty5121
0
880
typoなんかねぇよ
raspython3
0
670
コンパウンドプロダクト開発のためのローカルプロセスマネージャー再発明 #layerxgo
izumin5210
0
660
DynamoDBの基礎を振り返りながらベクトル検索機能を理解する
musan
3
270
『寄り添うラジオ』をAIで作る 体験価値から逆算した、会話しないUXと品質設計
theoriatec2024
3
130
Seeing Through Serverless: Observability for AWS Lambda with ADOT and CloudWatch Application Signals
seike460
PRO
1
120
PyConJP2026_wat_Python × Signal Processing: How to Draw Pictures with Sound Using Spectrogram Art
wat
0
680
AIと壁打ちしながら進めるコスト管理
fufuhu
2
2k
XHTMLが残したもの
yosuke_furukawa
PRO
2
440
PyO3 で既存 Python 評価器を Rust core 化する ー wasm-bindgen でブラウザにも配るための設計
kdash
1
560
XP祭りでしか伝わらないフリップネタ #xpjug
murabayashi
0
110
ソフトウェアラスタライザ
fadis
1
790
Featured
See All Featured
Odyssey Design
rkendrick25
PRO
2
800
The browser strikes back
jonoalderson
0
1.6k
Utilizing Notion as your number one productivity tool
mfonobong
4
580
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
It's Worth the Effort
3n
188
29k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
320
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
690
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
430
Tell your own story through comics
letsgokoyo
1
1.1k
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