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
Fragments: What are they good for?
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
David Hope
July 29, 2016
Technology
21k
2
Share
Fragments: What are they good for?
Fragments: What are they good for? Talk given at 360AnDev 2016 on July 28th, 2016
#360andev
David Hope
July 29, 2016
Other Decks in Technology
See All in Technology
自分のハンドルは自分で握れ! ― 自分のケイパビリティを増やし、メンバーのケイパビリティ獲得を支援する ― / Take the wheel yourself
takaking22
1
890
AWS DevOps Agentはチームメイトになれるのか?/ Can AWS DevOps Agent become a teammate
kinunori
6
710
60分で学ぶ最新Webフロントエンド
mizdra
PRO
35
18k
Introduction to Bill One Development Engineer
sansan33
PRO
0
410
こんなアーキテクチャ図はいやだ / Anti-pattern in AWS Architecture Diagrams
naospon
1
440
ワールドカフェI /チューターを改良する / World Café I and Improving the Tutors
ks91
PRO
0
320
クラウドネイティブな開発 ~ 認知負荷に立ち向かうためのコンテナ活用
literalice
0
110
Bill One 開発エンジニア 紹介資料
sansan33
PRO
6
18k
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
3k
Rapid Start: Faster Internet Connections, with Ruby's Help
kazuho
2
200
「責任あるAIエージェント」こそ自社で開発しよう!
minorun365
9
1.9k
Azure Speech で音声対応してみよう
kosmosebi
0
160
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
110
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Designing for humans not robots
tammielis
254
26k
How STYLIGHT went responsive
nonsquared
100
6.1k
The Limits of Empathy - UXLibs8
cassininazir
1
300
Skip the Path - Find Your Career Trail
mkilby
1
110
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.5k
Paper Plane
katiecoart
PRO
1
49k
Transcript
Fragments: WHAT ARE THEY GOOD FOR?
None
None
Overview u Why Fragments? u Different types u Anatomy u
Lifecycle u How to use u Common Usage u Best Practices
None
None
Types of Fragments
None
None
Static Fragment Example
Dynamic Fragments
Dynamic Fragment u Require Container u Framework u Support
Framework Fragments
Support Fragments
None
Fragment Lifecycle
None
None
None
None
onAttach ( )
onAttach( ) Example
onCreateView ( )
onCreateView( ) Example
onCreateView( ) Fixes u View – Hold Parameters u Inflater
– Add Layout u View Container – Collection for Views u Bundle –Reconstructs Fragment
onActivityCreated( )
onActivityCreated( ) Example
Standard Lifecycle ( )’s u onStart( ) u onResume( )
u onPause( )
onDestroyView ( )
onDestroyView( ) Example
onDetach ( )
onDetach( ) Example
newInstance( ) u Set up Fragment u Default Data u
Bundle u SetArgs( ) u GetArgs( )
New Instance( ) Example
How to Use
None
Fragment Manager u Manages Fragments in Activity u Holds list
of Fragments u Perform Transactions u Fluent Interface
Fragment Manager Example
Fragment ID
Fragment TAG
Identifying a Fragment u findFragmentById ( ) – Container ID
u findFragmentByTag( ) – String Constant
Fragment Transaction
Parts of a Transaction beginTransaction( ) Action commit( )
Basic Add, ID Example
Common Usage u Tablet u Tab Layout u Dialog Fragment
Tablet
Master Detail Flow
Fragments in Tablet u Dual Pane condition – Use Boolean
u Resource Qualifier
Resource Qualifier
Resource Qualifier u Change Configuration u Screen Width u 600
DPI – Tablet
Resource Qualifier Example
Tablet Example
Tab Layout
Tab Layout u Design Support Library u Fixed Tabs –
Most Common
View Pager
View Pager u Flip through pages u Support v4
Pager Adapter: 2 types
Fragment Pager Adapter
Fragment State Pager Adapter
Pager Adapter u getCount( ) – Number of Fragments u
getItem( ) – Position of Fragments u Fragment Pager Adapter u Fragment State Pager Adapter
Tab Layout & View Pager
Dialog Fragment
Dialog Fragment
Dialog Fragment u Restores AlertDialog u onCreateView( ) u onCreateDialog(
)
onCreateDialog( ) Example
Dialog Fragment Ex.
Odds and Ends u Navigation Drawer u Child Fragments u
Headless Fragments
None
None
Child Fragments
Headless Fragments
Best Practices u 3 – Fragments Activities u 5 –
Fragments Tab Layouts u Use Interfaces with Activities u Create early
None
None
None
Thank you @HopeDeveloper
None
Questions?