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
150
AndroidXに潜む便利なヤツら
Takuji Nishibayashi
April 19, 2019
Tweet
Share
More Decks by Takuji Nishibayashi
See All by Takuji Nishibayashi
CameraX使ってみた
takuji31
0
58
kotlinx.datetime 使ってみた
takuji31
0
220
HiltのCustom Componentについて
takuji31
0
140
java.timeをAndroidで使う
takuji31
0
53
KSPを使ってコード生成
takuji31
0
280
Kotlin Symbol Processing API (KSP) を使って Kotlin ア プリケーションの開発を効率化する
takuji31
1
940
kotlinx.serialization
takuji31
0
530
kanmoba-returns-02.pdf
takuji31
0
170
AndroidXとKotlin Coroutines
takuji31
0
330
Other Decks in Technology
See All in Technology
pandasはPolarsに性能面で追いつき追い越せるのか
vaaaaanquish
4
4.7k
Jr. Championsになって、強く連携しながらAWSをもっと使いたい!~AWSに対する期待と行動~
amixedcolor
0
190
AIを駆使したゲーム開発戦略: 新設AI組織の取り組み / sge-ai-strategy
cyberagentdevelopers
PRO
1
130
신뢰할 수 있는 AI 검색 엔진을 만들기 위한 Liner의 여정
huffon
0
370
10分でわかるfreeeのQA
freee
1
3.4k
Datachain会社紹介資料(2024年11月) / Company Deck
datachain
3
16k
2024-10-30-reInventStandby_StudyGroup_Intro
shinichirokawano
1
640
MAMを軸とした動画ハンドリングにおけるAI活用前提の整備と次世代ビジョン / abema-ai-mam
cyberagentdevelopers
PRO
1
120
国土交通省 データコンペ参加者向け勉強会
takehikohashimoto
0
130
新卒1年目が挑む!生成AI × マルチエージェントで実現する次世代オンボーディング / operation-ai-onboarding
cyberagentdevelopers
PRO
1
170
チームを主語にしてみる / Making "Team" the Subject
ar_tama
4
310
【若手エンジニア応援LT会】AWS Security Hubの活用に苦労した話
kazushi_ohata
0
170
Featured
See All Featured
The Language of Interfaces
destraynor
154
24k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Ruby is Unlike a Banana
tanoku
96
11k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Code Reviewing Like a Champion
maltzj
519
39k
Practical Orchestrator
shlominoach
186
10k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Producing Creativity
orderedlist
PRO
341
39k
Bash Introduction
62gerente
608
210k
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