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
100
kotlinx.datetime 使ってみた
takuji31
0
390
HiltのCustom Componentについて
takuji31
0
200
java.timeをAndroidで使う
takuji31
0
81
KSPを使ってコード生成
takuji31
0
330
Kotlin Symbol Processing API (KSP) を使って Kotlin ア プリケーションの開発を効率化する
takuji31
1
1k
kotlinx.serialization
takuji31
0
560
kanmoba-returns-02.pdf
takuji31
0
190
AndroidXとKotlin Coroutines
takuji31
0
350
Other Decks in Technology
See All in Technology
30分でわかる「リスクから学ぶKubernetesコンテナセキュリティ」/30min-k8s-container-sec
mochizuki875
3
430
Alignment and Autonomy in Cybozu - 300人の開発組織でアラインメントと自律性を両立させるアジャイルな組織運営 / RSGT2025
ama_ch
1
2.3k
GoogleのAIエージェント論 Authors: Julia Wiesinger, Patrick Marlow and Vladimir Vuskovic
customercloud
PRO
0
110
あなたの人生も変わるかも?AWS認定2つで始まったウソみたいな話
iwamot
3
820
embedパッケージを深掘りする / Deep Dive into embed Package in Go
task4233
1
200
東京Ruby会議12 Ruby と Rust と私 / Tokyo RubyKaigi 12 Ruby, Rust and me
eagletmt
3
840
Azureの開発で辛いところ
re3turn
0
240
Fabric 移行時の躓きポイントと対応策
ohata_ds
1
150
【JAWS-UG大阪 reInvent reCap LT大会 サンバが始まったら強制終了】“1分”で初めてのソロ参戦reInventを数字で振り返りながら反省する
ttelltte
0
130
AWS Community Builderのススメ - みんなもCommunity Builderに応募しよう! -
smt7174
0
150
RubyでKubernetesプログラミング
sat
PRO
4
150
今から、 今だからこそ始める Terraform で Azure 管理 / Managing Azure with Terraform: The Perfect Time to Start
nnstt1
0
180
Featured
See All Featured
Visualization
eitanlees
146
15k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Java REST API Framework Comparison - PWX 2021
mraible
28
8.3k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Building Adaptive Systems
keathley
38
2.4k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.8k
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
How to Ace a Technical Interview
jacobian
276
23k
Testing 201, or: Great Expectations
jmmastey
41
7.2k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
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