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
Android Architecture Componentの Navigationで少しは...
Search
bigbackboom
July 23, 2019
Technology
0
630
Android Architecture Componentの Navigationで少しはまった話
bigbackboom
July 23, 2019
Tweet
Share
More Decks by bigbackboom
See All by bigbackboom
Androidタブレットアプリ作成_棚から牡丹餅を得るにはまず棚から
bigbackboom
0
32
Proto Datastoreを使う前の心構え
bigbackboom
0
130
Extended A Study in Bitmap: Is NDK the fast Processing method by CPU?
bigbackboom
0
7
Have A Dog in CircleCI
bigbackboom
0
31
Androidエンジニアのお仕事でのショボーン
bigbackboom
0
55
解明!楽しいプレゼンする話すスキル
bigbackboom
0
54
Pay for Businessのgradle.ktsへの移行の小噺
bigbackboom
0
41
A Study in Bitmap: Is NDK the fast Processing method by CPU?
bigbackboom
0
250
Shallow Dip into Kotlin Coroutine
bigbackboom
0
190
Other Decks in Technology
See All in Technology
アプリケーションの中身が見える!Mackerel APMの全貌と展望 / Mackerel APMリリースパーティ
mackerelio
0
450
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
5
38k
Eight Engineering Unit 紹介資料
sansan33
PRO
0
3.2k
ローカル環境でAIを動かそう!
falken
PRO
1
170
JNation 2025 - Quarkus for Spring Developers
edeandrea
PRO
0
110
Data Hubグループ 紹介資料
sansan33
PRO
0
1.7k
OTel meets Wasm: プラグイン機構としてのWebAssemblyから見る次世代のObservability
lycorptech_jp
PRO
1
300
実践Kafka Streams 〜イベント駆動型アーキテクチャを添えて〜
joker1007
0
470
データプレーンプログラミングとは? DPU&スイッチASICの開発経験から語る
ebiken
PRO
1
270
CloudBruteによる外部からのS3バケットの探索・公開の発見について / 20250605 Kumiko Hennmi
shift_evolve
3
190
障害を回避するHttpClient再入門 / Avoiding Failures HttpClient Reintroduction
uskey512
1
150
Contract One Dev Group 紹介資料
sansan33
PRO
0
6k
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
251
12k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.7k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
137
34k
The Language of Interfaces
destraynor
158
25k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Statistics for Hackers
jakevdp
799
220k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
RailsConf 2023
tenderlove
30
1.1k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.8k
Building a Modern Day E-commerce SEO Strategy
aleyda
40
7.3k
Rebuilding a faster, lazier Slack
samanthasiow
81
9k
Transcript
Android Architecture Componentͷ NavigationͰগ͠·ͬͨ
ࣗݾհ — ٠/bigbackboom — CBcloudגࣜձࣾɹ
Navigationͱʁ — Google I/O 2018Ͱൃද͞ΕͨAndroid Architecture ComponentͷҰͭ — FragmentؒͷભҠΛϘτϜφϏͳͲͰߦ͏ͳͲෳࡶͳཁ݅ ͷͨΊʹ։ൃ͞Εͨɻ
— backstackͷཧ͕͍͠ — fragmentࣗମͷlifecycle͕ෳࡶ — ݟͨiOSͷstoryboardͳͲʹ͍͕ۙɺ༻ൣғ͍ͩ
ͳͥϘτϜφϏͰNavigationΛ͏ඞཁ͕͋Δʁ — Α͘ΘΕ͍ͯͨɺViewPager+BottomNavigationView ׂͱ࣮͕ෳࡶʢ࡞Δύʔπ͕ଟ͍ʣɻ — ViewPagerը໘ͷΩϟογϡॲཧ͕ಈ͘ͷͰɿ — ෳը໘͕ಉ࣌ʹಡΈࠐ·Εɺىಈ͕͘ͳΔ — ΩϟογϡʹΑͬͯɺը໘͕ഁغ͞Εબ࣌ʹҰ͔
ΒಡΈࠐ·ΕΔɻ
BottomNavigationView + NavigationΛ࣮ — ͜ͷrepositoryΛϕʔεʹΘ ͤͯΒ͍·ͨ͠ɻ — ߏӈͷը૾ͷΑ͏ʹͳ͍ͬͯ ·͢ɻ
λϒຖͷঢ়ଶҡ࣋ — Կ͠ͳ͍ͱɺ DashboardFragmentͱ NotificationsFragmentλϒ͕ બ͞ΕΔͨͼʹॳظԽ͞ΕΔ — ͦΕΛආ͚ΔͨΊʹɺ BottomNavigationViewͱ FragmentͷੜΛհ͢Δɺ
FragmentNavigatorΛࣗ࡞͢Δ ඞཁ͕͋Δɻ
— ࢀߟrepositoryͰ KeepStateNavigatorͱ͍͏ͷ Λ࡞͍ͬͯΔɻ — ·ͨɺBottomNavigationViewͱ FragmentͷؔΛఆٛͨ͠ɺ nav_graph.xmlͰ KeepStateNavigatorΛ༻ͯ͠ ͍Δ
ͰɾɾɾԿʹ·ͬͨͷʁ — Activity͔ΒFragmentʹΛ͢͜ͱ͕Ͱ͖ͳ͍ɾɾɾ — ௨ৗͰ͋Ε,ԼهͷΑ͏ʹ͢ΕΛϑϥάϝϯτʹͤ Δɻ val bundle = Bundle().apply
{ putString("NOTIFICATION_KEY", "bigbacbkboom is here") } NavController.navigate(item.itemId, bundle)
͕͔ͩ͠͠ɾɾɾ
null ͩͱɾɾɾ
దʹͨΓΛ͚ͭΔ
KeepStateNavigator෦ͰσόοΨͰࢭΊͯΈΔ — Έ͚ͬͽΐΜ
KeepStateNavigator.kt ίʔυΛमਖ਼ ҎԼͷߦΛҰͭՃ͢Δ͚ͩɻ var fragment = manager.findFragmentByTag(tag) fragment?.arguments = args
if (fragment == null) { val className = destination.className fragment = manager.fragmentFactory.instantiate(context.classLoader, className) transaction.add(containerId, fragment, tag) } else { transaction.attach(fragment) }
मਖ਼༰ʁ — fragmentΛੜ͢Δͱ͖ʹɺBundleΛͯ͋͛͠ΔॲཧΛ ॻ͚͍͍ͱ͍͏ࢸۃ୯७ͳͷͰ͢ɻ — ͨͩɺਓͷίʔυΛૉʹίϐʔͯͨ͠ͷͰɺΓ͜Ε ʹؾ͕ͭ͘ͷʹۤ࿑͠·ͨ͠ɻ
݁ — NavigationViewPage+BottomNavigationViewrΑΓ ύʔπ͕গͳָ͘ɻ — ͲΜͳ͜ͱಉ͡Ͱ͕͢ɺΓͲΜͳ͜ͱͪΌΜͱཧ ղ͠ͳ͍ͱ௧͍ΛݟΔɻ
We are Hiring! — Ұॹʹಇؒ͘Λ୳͍ͯ͠·͢ɻ — αʔϏεࢤͷํ — ੵۃతʹఏҊͯ͠৽͍ٕ͠ज़ͷΤϯδχΞϦϯάΛߦ͍ͨ ͍ํ
— ϚωʔδϝϯτΛ͍ͨ͠ํ https://www.wantedly.com/companies/cb-cloud