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
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
データとAIで明らかになる、私たちの課題 ~Snowflake MCP,Salesforce MCPに触れて~ / Data and AI Insights
kaonavi
0
230
SOTA競争から人間を超える画像認識へ
shinya7y
0
670
Amazon Q Developer CLIをClaude Codeから使うためのベストプラクティスを考えてみた
dar_kuma_san
0
310
実践マルチモーダル検索!
shibuiwilliam
3
520
SREのキャリアから経営に近づく - Enterprise Risk Managementを基に -
shonansurvivors
1
690
初海外がre:Inventだった人間の感じたこと
tommy0124
1
180
JAWS UG AI/ML #32 Amazon BedrockモデルのライフサイクルとEOL対応/How Amazon Bedrock Model Lifecycle Works
quiver
1
610
20251027_findyさん_音声エージェントLT
almondo_event
2
530
Kotlinで型安全にバイテンポラルデータを扱いたい! ReladomoラッパーをAIと実装してみた話
itohiro73
3
140
OpenCensusと歩んだ7年間
bgpat
0
300
現場の壁を乗り越えて、 「計装注入」が拓く オブザーバビリティ / Beyond the Field Barriers: Instrumentation Injection and the Future of Observability
aoto
PRO
1
820
知覚とデザイン
rinchoku
1
720
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Context Engineering - Making Every Token Count
addyosmani
8
330
How to train your dragon (web standard)
notwaldorf
97
6.3k
Java REST API Framework Comparison - PWX 2021
mraible
34
8.9k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Understanding Cognitive Biases in Performance Measurement
bluesmoon
31
2.7k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Docker and Python
trallard
46
3.6k
Building Applications with DynamoDB
mza
96
6.7k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
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?