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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
David Hope
July 29, 2016
Technology
2
21k
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
Tweet
Share
Other Decks in Technology
See All in Technology
A Gentle Introduction to Transformers
keio_smilab
PRO
2
900
ヘルシーSRE
tk3fftk
2
240
DX Improvement at Scale
ntk1000
3
340
Data Hubグループ 紹介資料
sansan33
PRO
0
2.8k
「ストレッチゾーンに挑戦し続ける」ことって難しくないですか? メンバーの持続的成長を支えるEMの環境設計
sansantech
PRO
3
380
8万デプロイ
iwamot
PRO
2
180
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
72k
DevOpsエージェントで実現する!! AWS Well-Architected(W-A) を実現するシステム設計 / 20260307 Masaki Okuda
shift_evolve
PRO
3
240
JAWS Days 2026 楽しく学ぼう! 認証認可 入門/20260307-jaws-days-novice-lane-auth
opelab
9
1.5k
AIエージェント・エコノミーの幕開け 〜 オープンプロトコルが変えるビジネスの未来 〜
shukob
0
110
Windows ネットワークを再確認する
murachiakira
PRO
0
290
OCI Security サービス 概要
oracle4engineer
PRO
2
13k
Featured
See All Featured
The untapped power of vector embeddings
frankvandijk
2
1.6k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
140
Skip the Path - Find Your Career Trail
mkilby
1
72
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
460
A Soul's Torment
seathinner
5
2.4k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
180
4 Signs Your Business is Dying
shpigford
187
22k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
From π to Pie charts
rasagy
0
150
Making Projects Easy
brettharned
120
6.6k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
470
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
430
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?