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
21k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
GuardDuty 検知対応を DevOps Agent で効率化しようとしている話 / GuardDuty Investigations with DevOps Agent
masahirokawahara
1
280
本番に近いテストをもっと手軽に - Postmanで広がるAPIテストの世界 / Expanding the World of API Testing with Postman
yokawasa
1
240
Bet AI Day 2026丨バクラク Autopilot、業務システムの再設計
layerx
PRO
2
1.1k
はじめてのDatabricks:技術者向けワークショップ / beginner-workshop
databricksjapan
PRO
0
140
振り返りこそエンジニアの本領
negima
0
260
PfEingのアプローチで働こう
rindrics
0
160
AndroidでHDRメディアを「壊さずに」扱う
chigichan24
0
380
書籍『生成AIの安全性入門』の入門
wataoka
0
210
Beyond the Hype: Practical AI for Your Oracle Database with MCP
thatjeffsmith
1
230
Instana&Bob トラブルシュートハンズオン
mayamasaki68
0
110
リージョンの壁を越える、 ちょっと変わったAWSサービスの話
falken
PRO
0
200
データエンジニアの困りごとをDevinと一緒に解消する
10xinc
2
790
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Claude Code のすすめ
schroneko
67
230k
エンジニアに許された特別な時間の終わり
watany
108
250k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Design in an AI World
tapps
1
300
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
260
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
What does AI have to do with Human Rights?
axbom
PRO
1
2.4k
KATA
mclloyd
PRO
35
15k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
760
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
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?