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
610
Android Architecture Componentの Navigationで少しはまった話
bigbackboom
July 23, 2019
Tweet
Share
More Decks by bigbackboom
See All by bigbackboom
Proto Datastoreを使う前の心構え
bigbackboom
0
100
Extended A Study in Bitmap: Is NDK the fast Processing method by CPU?
bigbackboom
0
2
Have A Dog in CircleCI
bigbackboom
0
18
Androidエンジニアのお仕事でのショボーン
bigbackboom
0
48
解明!楽しいプレゼンする話すスキル
bigbackboom
0
46
Pay for Businessのgradle.ktsへの移行の小噺
bigbackboom
0
32
A Study in Bitmap: Is NDK the fast Processing method by CPU?
bigbackboom
0
230
Shallow Dip into Kotlin Coroutine
bigbackboom
0
170
RecyclerViewでViewPagerっぽいの作ろうとして頓死した話
bigbackboom
0
1.5k
Other Decks in Technology
See All in Technology
転生CISOサバイバル・ガイド / CISO Career Transition Survival Guide
kanny
2
390
Postmanを使いこなす!2025年ぜひとも押さえておきたいPostmanの10の機能
nagix
2
120
家電アプリ共通PF "Linova" のAPI利用とPostman活用事例ご紹介
yukiogawa
0
130
AWSでRAGを実現する上で感じた3つの大事なこと
ymae
3
1k
株式会社EventHub・エンジニア採用資料
eventhub
0
4.2k
データ基盤の成長を加速させる:アイスタイルにおける挑戦と教訓
tsuda7
3
650
High Performance PHP
cmuench
0
140
RSNA2024振り返り
nanachi
0
500
[2025-02-07]生成AIで変える問い合わせの未来 〜チームグローバル化の香りを添えて〜
tosite
1
290
AndroidXR 開発ツールごとの できることできないこと
donabe3
0
110
Developers Summit 2025 浅野卓也(13-B-7 LegalOn Technologies)
legalontechnologies
PRO
0
150
事業継続を支える自動テストの考え方
tsuemura
0
300
Featured
See All Featured
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
20
2.4k
Typedesign – Prime Four
hannesfritz
40
2.5k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
99
18k
Visualization
eitanlees
146
15k
Testing 201, or: Great Expectations
jmmastey
41
7.2k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Build The Right Thing And Hit Your Dates
maggiecrowley
34
2.5k
The Cost Of JavaScript in 2023
addyosmani
47
7.3k
Designing Experiences People Love
moore
139
23k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
29
4.6k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
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