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
AndroidXに潜む便利なヤツら
Search
Takuji Nishibayashi
April 19, 2019
Technology
0
160
AndroidXに潜む便利なヤツら
Takuji Nishibayashi
April 19, 2019
Tweet
Share
More Decks by Takuji Nishibayashi
See All by Takuji Nishibayashi
CameraX使ってみた
takuji31
0
66
kotlinx.datetime 使ってみた
takuji31
0
260
HiltのCustom Componentについて
takuji31
0
150
java.timeをAndroidで使う
takuji31
0
60
KSPを使ってコード生成
takuji31
0
290
Kotlin Symbol Processing API (KSP) を使って Kotlin ア プリケーションの開発を効率化する
takuji31
1
960
kotlinx.serialization
takuji31
0
540
kanmoba-returns-02.pdf
takuji31
0
180
AndroidXとKotlin Coroutines
takuji31
0
330
Other Decks in Technology
See All in Technology
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
7
2.7k
AWS Lambdaと歩んだ“サーバーレス”と今後 #lambda_10years
yoshidashingo
1
180
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
600
生成AIが変えるデータ分析の全体像
ishikawa_satoru
0
170
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
28
13k
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
300
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
310
ノーコードデータ分析ツールで体験する時系列データ分析超入門
negi111111
0
420
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
9
1.1k
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
8
870
AWS Lambda のトラブルシュートをしていて思うこと
kazzpapa3
2
180
Featured
See All Featured
Code Review Best Practice
trishagee
64
17k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Embracing the Ebb and Flow
colly
84
4.5k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Speed Design
sergeychernyshev
25
620
How to Ace a Technical Interview
jacobian
276
23k
A designer walks into a library…
pauljervisheath
204
24k
Building Your Own Lightsaber
phodgson
103
6.1k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Transcript
AndroidXʹજΉศརͦ͏ͳϠπΒ @takuji31 Mobile Act KYOTO #1
ࣗݾհ
ࣗݾհ • @takuji31 id:takuji31 • Takuji Nishibayashi • Hatena Co.,
Ltd. • App Team • ίϛοΫDAYS • δϟϯϓϧʔΩʔʂ • ΧΫϤϜ
ࣗݾհ • Android • Kotlin • Flu-er • ! h-ps:/
/blog.takuji31.jp • " h-ps:/ /nazuna.takuji31.jp • # $ h-ps:/ /photo.takuji31.jp
AndroidX
LiveData? ViewModel? AppCompat? Naviga5on
ͬͯ·͢ΑͶ
ศརͳͭ৭ʑհ͠·͢
α൛ͷͷؚ·ΕΔͷͰ ͝ར༻ܭըతʹ
ଞʹ͍͍ͷ͋ͬͨΒ ڭ͍͑ͯͩ͘͞ʂ
androidx.ac*vity androidx.fragment
ComponentActivity.viewModels{} Fragment.viewModels{} Fragment.activityViewModels{}
ViewModelΛऔಘͰ͖Δ Delegated property
viewModels ҾͰ ViewModelStoreOwnerΛ୳͢ blockΛͤΔ
valʹͰ͖Δ
Goodbye! private lateinit var
@ContentView
ComponentAc*vity ͱ Fragmentʹ secondory constructor͕Ճ
constructorͷҾʹLayoutͷIDΛ ͤΔ
Goodbye setContentView()
DataBindingbind͢ΕΑͦ͞͏
androidx.lifecycle
ViewModelͱ͔LiveDataͱ͔ೖͬͯ ΔΞϨ
ViewModel.viewModelScope
ViewModelͷCorou,neScope
Context Dispatchers.Main + Job
onCleared() ͰΩϟϯηϧ
Saved State
ViewModelը໘ճసΛੜ͖Δ
Ac#vity͕ϝϞϦʔ͔Β ഁغ͞ΕΔ࣌ࢮ͵
SavedStateHandler Ͱঢ়ଶΛ෮ݩͰ͖Δ
γϯϓϧͳ set/get/remove/contains
getLiveData()
see. h&ps:/ /developer.android.com/ topic/libraries/architecture/ viewmodel-savedstate
androidx.navigation
Naviga&onͷΞϨ
androidx.navigation.safeargs androidx.navigation.safeargs.kotlin
Naviga&onͷxmlʹఆٛͨ͠ભҠઌ ͷargsΛࣗಈੜ
KotlinίʔυੜՄೳ
Goodbye createIntent() methods!
Naviga&onͰը໘ભҠ͠ͳͯ͘ ͑Δ
·ͣͬͯΈͯʂ
Fragment.navGraphViewModels()
ࢦఆͨ͠Naviga&onͷgraphͰੜ͖ ΔFragment
NavHostFragmentͷFragment Ͱ͏ɺΈ͍ͨͳײ͡ͷ࣌ʹ͑ͦ ͏
͜Εॻ͍ͯͯࠓ࣮ͯ͠Δը໘Ͱ ͑ͦ͏ͱࢥͬͨͷͰ͏༧ఆ
h"ps:/ /developer.android.com/ jetpack/androidx