SlideShare une entreprise Scribd logo
1  sur  9
Télécharger pour lire hors ligne
Android Fragment
2012/11/19 John
Fragment
A Fragment represents a behavior or a portion of user interface in an Activity.
You can combine multiple fragments in a single activity to build a multi-pane UI
and reuse a fragment in multiple activities. You can think of a fragment as a
modular section of an activity, which has its own lifecycle, receives its own input
events, and which you can add or remove while the activity is running (sort of
like a "sub activity" that you can reuse in different activities).
A fragment must always be embedded in an activity and the fragment's lifecycle
is directly affected by the host activity's lifecycle. For example, when the activity
is paused, so are all fragments in it, and when the activity is destroyed, so are
all fragments. However, while an activity is running (it is in the resumed lifecycle
state), you can manipulate each fragment independently, such as add or
remove them. When you perform such a fragment transaction, you can also
add it to a back stack that's managed by the activity—each back stack entry in
the activity is a record of the fragment transaction that occurred. The back stack
allows the user to reverse a fragment transaction (navigate backwards), by
pressing the Back button.
Design Philosophy
For example—to continue with the news application example—the application
can embed two fragments in Activity A, when running on a tablet-sized device.
However, on a handset-sized screen, there's not enough room for both
fragments, so Activity A includes only the fragment for the list of articles, and
when the user selects an article, it starts Activity B, which includes the second
fragment to read the article. Thus, the application supports both tablets and
handsets by reusing fragments in different combinations, as illustrated in figure
1.
Creating a Fragment
To create a fragment, you must create a
subclass of Fragment (or an existing subclass of
it). The Fragment class has code that looks a lot
like an Activity. It contains callback methods
similar to an activity, such as onCreate(),
onStart(), onPause(), and onStop(). In fact, if
you're converting an existing Android application
to use fragments, you might simply move code
from your activity's callback methods into the
respective callback methods of your fragment.
Handling the Fragment Lifecycle
Also like an activity, you can retain the state of
a fragment using a Bundle, in case the
activity's process is killed and you need to
restore the fragment state when the activity is
recreated. You can save the state during the
fragment's onSaveInstanceState() callback
and restore it during either onCreate(),
onCreateView(), or onActivityCreated(). For
more information about saving state, see the
Activities document.
Three Type View (in our project)
I (Fragment) II (Layout View)
III (DialogFragment)
Three Type View (in our project)
● There's view all in the same Activity.
● View control by Activity.
● Every data transaction with controller
need to over the Activity as your
view's controller.
Three Type View (in our project)
View Type Control
Help Guide Page
I (Fragment)
Activity
Channel list Page
Program Info Page
Schedule Record Page
Schedule List Page
Startup Page
Play list Page
EPG Search
II (DialogFragment)Subtitle Subaudio
Parental Control
Error Message III (Layout View)
References web site
Android Develop Guide
Fragment: http://developer.android.com/guide/components/fragments.html
Supporting Multiple Screen: http://developer.android.
com/guide/practices/screens_support.html
Blog
Fragment中文: http://leybreeze.com/blog/?p=902
Merge: http://zhuyonghui116.blog.hexun.com.tw/49165333_d.html
Include: http://158067568.iteye.com/blog/932206

Contenu connexe

Tendances

Android activity lifecycle
Android activity lifecycleAndroid activity lifecycle
Android activity lifecycleSoham Patel
 
[Android] Widget Event Handling
[Android] Widget Event Handling[Android] Widget Event Handling
[Android] Widget Event HandlingNikmesoft Ltd
 
Presentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestatePresentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestateOsahon Gino Ediagbonya
 
Android activity
Android activityAndroid activity
Android activityKrazy Koder
 
Android Programming Basics
Android Programming BasicsAndroid Programming Basics
Android Programming BasicsEueung Mulyana
 
Android | Android Activity Launch Modes and Tasks | Gonçalo Silva
Android | Android Activity Launch Modes and Tasks | Gonçalo SilvaAndroid | Android Activity Launch Modes and Tasks | Gonçalo Silva
Android | Android Activity Launch Modes and Tasks | Gonçalo SilvaJAX London
 
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & viewsma-polimi
 
Intents in Android
Intents in AndroidIntents in Android
Intents in Androidma-polimi
 
Android jetpack compose | Declarative UI
Android jetpack compose | Declarative UI Android jetpack compose | Declarative UI
Android jetpack compose | Declarative UI Ajinkya Saswade
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android DevelopmentAly Abdelkareem
 

Tendances (20)

Android activity lifecycle
Android activity lifecycleAndroid activity lifecycle
Android activity lifecycle
 
[Android] Widget Event Handling
[Android] Widget Event Handling[Android] Widget Event Handling
[Android] Widget Event Handling
 
Presentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestatePresentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestate
 
Android activity
Android activityAndroid activity
Android activity
 
05 intent
05 intent05 intent
05 intent
 
Event handling
Event handlingEvent handling
Event handling
 
Command Pattern
Command PatternCommand Pattern
Command Pattern
 
Android Programming Basics
Android Programming BasicsAndroid Programming Basics
Android Programming Basics
 
Broadcast Receiver
Broadcast ReceiverBroadcast Receiver
Broadcast Receiver
 
Android Intent.pptx
Android Intent.pptxAndroid Intent.pptx
Android Intent.pptx
 
Android | Android Activity Launch Modes and Tasks | Gonçalo Silva
Android | Android Activity Launch Modes and Tasks | Gonçalo SilvaAndroid | Android Activity Launch Modes and Tasks | Gonçalo Silva
Android | Android Activity Launch Modes and Tasks | Gonçalo Silva
 
Android User Interface
Android User InterfaceAndroid User Interface
Android User Interface
 
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & views
 
Javascript
JavascriptJavascript
Javascript
 
Intents in Android
Intents in AndroidIntents in Android
Intents in Android
 
Android jetpack compose | Declarative UI
Android jetpack compose | Declarative UI Android jetpack compose | Declarative UI
Android jetpack compose | Declarative UI
 
Android UI
Android UIAndroid UI
Android UI
 
Dart programming language
Dart programming languageDart programming language
Dart programming language
 
Android Services
Android ServicesAndroid Services
Android Services
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 

En vedette

Android App Development - 06 Fragments
Android App Development - 06 FragmentsAndroid App Development - 06 Fragments
Android App Development - 06 FragmentsDiego Grancini
 
Android - Working with Fragments
Android - Working with FragmentsAndroid - Working with Fragments
Android - Working with FragmentsCan Elmas
 
Android Fragment-Awesome
Android Fragment-AwesomeAndroid Fragment-Awesome
Android Fragment-AwesomeGauntFace
 
Short Intro to Android Fragments
Short Intro to Android FragmentsShort Intro to Android Fragments
Short Intro to Android FragmentsJussi Pohjolainen
 
Intro to Google TV
Intro to Google TVIntro to Google TV
Intro to Google TVGauntFace
 
Mobile in a Nutshell
Mobile in a NutshellMobile in a Nutshell
Mobile in a NutshellGauntFace
 
India’s 1st online Independence Day Celebration
India’s 1st online Independence Day CelebrationIndia’s 1st online Independence Day Celebration
India’s 1st online Independence Day Celebration4nought4
 
Belief: learning about new problems from old things
Belief: learning about new problems from old thingsBelief: learning about new problems from old things
Belief: learning about new problems from old thingsSara-Jayne Terp
 
Susanna Hintsala, itsemääräämisoikeus käytännössä, Autismin talvipäivät 2017
Susanna Hintsala, itsemääräämisoikeus käytännössä, Autismin talvipäivät 2017Susanna Hintsala, itsemääräämisoikeus käytännössä, Autismin talvipäivät 2017
Susanna Hintsala, itsemääräämisoikeus käytännössä, Autismin talvipäivät 2017Autismiliitto
 
Petaluma Community Guild Guild Glyphosate Forum — Krupnick: Green Alternative...
Petaluma Community Guild Guild Glyphosate Forum — Krupnick: Green Alternative...Petaluma Community Guild Guild Glyphosate Forum — Krupnick: Green Alternative...
Petaluma Community Guild Guild Glyphosate Forum — Krupnick: Green Alternative...Petaluma Grange
 
Google I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb HighlightsGoogle I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb HighlightsRomain Guy
 
Judith Gould, autismikirjon naisten ja tyttöjen diagnosointi, Autismin talvip...
Judith Gould, autismikirjon naisten ja tyttöjen diagnosointi, Autismin talvip...Judith Gould, autismikirjon naisten ja tyttöjen diagnosointi, Autismin talvip...
Judith Gould, autismikirjon naisten ja tyttöjen diagnosointi, Autismin talvip...Autismiliitto
 
Fragments notes powerpoint
Fragments notes powerpointFragments notes powerpoint
Fragments notes powerpointktyndall
 
[Android] PLAYING WITH FRAGMENT
[Android] PLAYING WITH FRAGMENT[Android] PLAYING WITH FRAGMENT
[Android] PLAYING WITH FRAGMENTJun Shimizu
 

En vedette (17)

Android App Development - 06 Fragments
Android App Development - 06 FragmentsAndroid App Development - 06 Fragments
Android App Development - 06 Fragments
 
Android - Working with Fragments
Android - Working with FragmentsAndroid - Working with Fragments
Android - Working with Fragments
 
Android Fragment-Awesome
Android Fragment-AwesomeAndroid Fragment-Awesome
Android Fragment-Awesome
 
Short Intro to Android Fragments
Short Intro to Android FragmentsShort Intro to Android Fragments
Short Intro to Android Fragments
 
Intro to Google TV
Intro to Google TVIntro to Google TV
Intro to Google TV
 
Mobile in a Nutshell
Mobile in a NutshellMobile in a Nutshell
Mobile in a Nutshell
 
Fragment debugging
Fragment debuggingFragment debugging
Fragment debugging
 
India’s 1st online Independence Day Celebration
India’s 1st online Independence Day CelebrationIndia’s 1st online Independence Day Celebration
India’s 1st online Independence Day Celebration
 
παιδεία, εκπαίδευση
παιδεία, εκπαίδευσηπαιδεία, εκπαίδευση
παιδεία, εκπαίδευση
 
Belief: learning about new problems from old things
Belief: learning about new problems from old thingsBelief: learning about new problems from old things
Belief: learning about new problems from old things
 
Susanna Hintsala, itsemääräämisoikeus käytännössä, Autismin talvipäivät 2017
Susanna Hintsala, itsemääräämisoikeus käytännössä, Autismin talvipäivät 2017Susanna Hintsala, itsemääräämisoikeus käytännössä, Autismin talvipäivät 2017
Susanna Hintsala, itsemääräämisoikeus käytännössä, Autismin talvipäivät 2017
 
Petaluma Community Guild Guild Glyphosate Forum — Krupnick: Green Alternative...
Petaluma Community Guild Guild Glyphosate Forum — Krupnick: Green Alternative...Petaluma Community Guild Guild Glyphosate Forum — Krupnick: Green Alternative...
Petaluma Community Guild Guild Glyphosate Forum — Krupnick: Green Alternative...
 
Google I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb HighlightsGoogle I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb Highlights
 
Judith Gould, autismikirjon naisten ja tyttöjen diagnosointi, Autismin talvip...
Judith Gould, autismikirjon naisten ja tyttöjen diagnosointi, Autismin talvip...Judith Gould, autismikirjon naisten ja tyttöjen diagnosointi, Autismin talvip...
Judith Gould, autismikirjon naisten ja tyttöjen diagnosointi, Autismin talvip...
 
Fragments notes powerpoint
Fragments notes powerpointFragments notes powerpoint
Fragments notes powerpoint
 
[Android] PLAYING WITH FRAGMENT
[Android] PLAYING WITH FRAGMENT[Android] PLAYING WITH FRAGMENT
[Android] PLAYING WITH FRAGMENT
 
Bt1 2015
Bt1 2015Bt1 2015
Bt1 2015
 

Similaire à Android Fragment

android activity
android activityandroid activity
android activityDeepa Rani
 
Fragments In Android
Fragments In AndroidFragments In Android
Fragments In AndroidDivyaKS12
 
Mad textbook 63-116
Mad textbook 63-116Mad textbook 63-116
Mad textbook 63-116PrathishGM
 
Android development Training Programme Day 2
Android development Training Programme Day 2Android development Training Programme Day 2
Android development Training Programme Day 2DHIRAJ PRAVIN
 
Tk2323 lecture 6 fragment (new)
Tk2323 lecture 6   fragment (new)Tk2323 lecture 6   fragment (new)
Tk2323 lecture 6 fragment (new)MengChun Lam
 
Android apps development
Android apps developmentAndroid apps development
Android apps developmentMonir Zzaman
 
Unit 5 Activity and Activity Life Cycle.pptx
Unit 5 Activity and Activity Life Cycle.pptxUnit 5 Activity and Activity Life Cycle.pptx
Unit 5 Activity and Activity Life Cycle.pptxShantanuDharekar
 
深入淺出談Fragment
深入淺出談Fragment深入淺出談Fragment
深入淺出談Fragment毅 方
 
Lecture #4 activities & fragments
Lecture #4  activities & fragmentsLecture #4  activities & fragments
Lecture #4 activities & fragmentsVitali Pekelis
 
Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)Gabor Varadi
 

Similaire à Android Fragment (20)

Android development session 4 - Fragments
Android development   session 4 - FragmentsAndroid development   session 4 - Fragments
Android development session 4 - Fragments
 
Activity
ActivityActivity
Activity
 
Activity
ActivityActivity
Activity
 
Activity
ActivityActivity
Activity
 
Activity
ActivityActivity
Activity
 
android activity
android activityandroid activity
android activity
 
Fragments In Android
Fragments In AndroidFragments In Android
Fragments In Android
 
Mad textbook 63-116
Mad textbook 63-116Mad textbook 63-116
Mad textbook 63-116
 
fragments-activity.pptx
fragments-activity.pptxfragments-activity.pptx
fragments-activity.pptx
 
Android development Training Programme Day 2
Android development Training Programme Day 2Android development Training Programme Day 2
Android development Training Programme Day 2
 
Tk2323 lecture 6 fragment (new)
Tk2323 lecture 6   fragment (new)Tk2323 lecture 6   fragment (new)
Tk2323 lecture 6 fragment (new)
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Lesson 4
Lesson 4Lesson 4
Lesson 4
 
Unit 5 Activity and Activity Life Cycle.pptx
Unit 5 Activity and Activity Life Cycle.pptxUnit 5 Activity and Activity Life Cycle.pptx
Unit 5 Activity and Activity Life Cycle.pptx
 
Fragments
FragmentsFragments
Fragments
 
深入淺出談Fragment
深入淺出談Fragment深入淺出談Fragment
深入淺出談Fragment
 
Lecture #4 activities & fragments
Lecture #4  activities & fragmentsLecture #4  activities & fragments
Lecture #4 activities & fragments
 
Android
AndroidAndroid
Android
 
Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)
 
Lab3-Android
Lab3-AndroidLab3-Android
Lab3-Android
 

Plus de Kan-Han (John) Lu

Working process and git branch strategy
Working process and git branch strategyWorking process and git branch strategy
Working process and git branch strategyKan-Han (John) Lu
 
Deep neural network for youtube recommendations
Deep neural network for youtube recommendationsDeep neural network for youtube recommendations
Deep neural network for youtube recommendationsKan-Han (John) Lu
 
Twitter as a personalizable information service ii
Twitter as a personalizable information service iiTwitter as a personalizable information service ii
Twitter as a personalizable information service iiKan-Han (John) Lu
 
Multimedia data minig and analytics sentiment analysis using social multimedia
Multimedia data minig and analytics sentiment analysis using social multimediaMultimedia data minig and analytics sentiment analysis using social multimedia
Multimedia data minig and analytics sentiment analysis using social multimediaKan-Han (John) Lu
 
ARM: Trusted Zone on Android
ARM: Trusted Zone on AndroidARM: Trusted Zone on Android
ARM: Trusted Zone on AndroidKan-Han (John) Lu
 
Android Training - Card Style
Android Training - Card StyleAndroid Training - Card Style
Android Training - Card StyleKan-Han (John) Lu
 
Android Training - View Pager
Android Training - View PagerAndroid Training - View Pager
Android Training - View PagerKan-Han (John) Lu
 
Android Training - Sliding Menu
Android Training - Sliding MenuAndroid Training - Sliding Menu
Android Training - Sliding MenuKan-Han (John) Lu
 
Android Training - Pull to Refresh
Android Training - Pull to RefreshAndroid Training - Pull to Refresh
Android Training - Pull to RefreshKan-Han (John) Lu
 
Code analyzer: FindBugs and PMD
Code analyzer: FindBugs and PMDCode analyzer: FindBugs and PMD
Code analyzer: FindBugs and PMDKan-Han (John) Lu
 
Android Training - Content Sharing
Android Training - Content SharingAndroid Training - Content Sharing
Android Training - Content SharingKan-Han (John) Lu
 
Android Training - Action Bar
Android Training - Action BarAndroid Training - Action Bar
Android Training - Action BarKan-Han (John) Lu
 

Plus de Kan-Han (John) Lu (20)

Dagger for android
Dagger for androidDagger for android
Dagger for android
 
Android develop guideline
Android develop guidelineAndroid develop guideline
Android develop guideline
 
Working process and git branch strategy
Working process and git branch strategyWorking process and git branch strategy
Working process and git branch strategy
 
Deep neural network for youtube recommendations
Deep neural network for youtube recommendationsDeep neural network for youtube recommendations
Deep neural network for youtube recommendations
 
Android testing part i
Android testing part iAndroid testing part i
Android testing part i
 
Cuda project paper
Cuda project paperCuda project paper
Cuda project paper
 
Twitter as a personalizable information service ii
Twitter as a personalizable information service iiTwitter as a personalizable information service ii
Twitter as a personalizable information service ii
 
Multimedia data minig and analytics sentiment analysis using social multimedia
Multimedia data minig and analytics sentiment analysis using social multimediaMultimedia data minig and analytics sentiment analysis using social multimedia
Multimedia data minig and analytics sentiment analysis using social multimedia
 
Android IPC: Binder
Android IPC: BinderAndroid IPC: Binder
Android IPC: Binder
 
ARM: Trusted Zone on Android
ARM: Trusted Zone on AndroidARM: Trusted Zone on Android
ARM: Trusted Zone on Android
 
Android Training - Card Style
Android Training - Card StyleAndroid Training - Card Style
Android Training - Card Style
 
Android Training - View Pager
Android Training - View PagerAndroid Training - View Pager
Android Training - View Pager
 
Android Training - Sliding Menu
Android Training - Sliding MenuAndroid Training - Sliding Menu
Android Training - Sliding Menu
 
Android Training - Pull to Refresh
Android Training - Pull to RefreshAndroid Training - Pull to Refresh
Android Training - Pull to Refresh
 
Java: Exception Handling
Java: Exception HandlingJava: Exception Handling
Java: Exception Handling
 
Dynamic Proxy by Java
Dynamic Proxy by JavaDynamic Proxy by Java
Dynamic Proxy by Java
 
Code analyzer: FindBugs and PMD
Code analyzer: FindBugs and PMDCode analyzer: FindBugs and PMD
Code analyzer: FindBugs and PMD
 
Android UI System
Android UI SystemAndroid UI System
Android UI System
 
Android Training - Content Sharing
Android Training - Content SharingAndroid Training - Content Sharing
Android Training - Content Sharing
 
Android Training - Action Bar
Android Training - Action BarAndroid Training - Action Bar
Android Training - Action Bar
 

Dernier

Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencyHire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencySheetal Arora
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...RohitNehra6
 
Botany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfBotany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfSumit Kumar yadav
 
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡anilsa9823
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)Areesha Ahmad
 
fundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomologyfundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomologyDrAnita Sharma
 
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...ssifa0344
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoSérgio Sacani
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...Sérgio Sacani
 
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPirithiRaju
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)PraveenaKalaiselvan1
 
Natural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsNatural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsAArockiyaNisha
 
DIFFERENCE IN BACK CROSS AND TEST CROSS
DIFFERENCE IN  BACK CROSS AND TEST CROSSDIFFERENCE IN  BACK CROSS AND TEST CROSS
DIFFERENCE IN BACK CROSS AND TEST CROSSLeenakshiTyagi
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsSérgio Sacani
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSarthak Sekhar Mondal
 
Botany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdfBotany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdfSumit Kumar yadav
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRDelhi Call girls
 
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticssakshisoni2385
 
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINChromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINsankalpkumarsahoo174
 

Dernier (20)

Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencyHire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...
 
Botany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfBotany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdf
 
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)
 
fundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomologyfundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomology
 
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on Io
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
 
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)
 
Natural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsNatural Polymer Based Nanomaterials
Natural Polymer Based Nanomaterials
 
DIFFERENCE IN BACK CROSS AND TEST CROSS
DIFFERENCE IN  BACK CROSS AND TEST CROSSDIFFERENCE IN  BACK CROSS AND TEST CROSS
DIFFERENCE IN BACK CROSS AND TEST CROSS
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
 
The Philosophy of Science
The Philosophy of ScienceThe Philosophy of Science
The Philosophy of Science
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
 
Botany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdfBotany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdf
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
 
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
 
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINChromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
 

Android Fragment

  • 2. Fragment A Fragment represents a behavior or a portion of user interface in an Activity. You can combine multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple activities. You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own input events, and which you can add or remove while the activity is running (sort of like a "sub activity" that you can reuse in different activities). A fragment must always be embedded in an activity and the fragment's lifecycle is directly affected by the host activity's lifecycle. For example, when the activity is paused, so are all fragments in it, and when the activity is destroyed, so are all fragments. However, while an activity is running (it is in the resumed lifecycle state), you can manipulate each fragment independently, such as add or remove them. When you perform such a fragment transaction, you can also add it to a back stack that's managed by the activity—each back stack entry in the activity is a record of the fragment transaction that occurred. The back stack allows the user to reverse a fragment transaction (navigate backwards), by pressing the Back button.
  • 3. Design Philosophy For example—to continue with the news application example—the application can embed two fragments in Activity A, when running on a tablet-sized device. However, on a handset-sized screen, there's not enough room for both fragments, so Activity A includes only the fragment for the list of articles, and when the user selects an article, it starts Activity B, which includes the second fragment to read the article. Thus, the application supports both tablets and handsets by reusing fragments in different combinations, as illustrated in figure 1.
  • 4. Creating a Fragment To create a fragment, you must create a subclass of Fragment (or an existing subclass of it). The Fragment class has code that looks a lot like an Activity. It contains callback methods similar to an activity, such as onCreate(), onStart(), onPause(), and onStop(). In fact, if you're converting an existing Android application to use fragments, you might simply move code from your activity's callback methods into the respective callback methods of your fragment.
  • 5. Handling the Fragment Lifecycle Also like an activity, you can retain the state of a fragment using a Bundle, in case the activity's process is killed and you need to restore the fragment state when the activity is recreated. You can save the state during the fragment's onSaveInstanceState() callback and restore it during either onCreate(), onCreateView(), or onActivityCreated(). For more information about saving state, see the Activities document.
  • 6. Three Type View (in our project) I (Fragment) II (Layout View) III (DialogFragment)
  • 7. Three Type View (in our project) ● There's view all in the same Activity. ● View control by Activity. ● Every data transaction with controller need to over the Activity as your view's controller.
  • 8. Three Type View (in our project) View Type Control Help Guide Page I (Fragment) Activity Channel list Page Program Info Page Schedule Record Page Schedule List Page Startup Page Play list Page EPG Search II (DialogFragment)Subtitle Subaudio Parental Control Error Message III (Layout View)
  • 9. References web site Android Develop Guide Fragment: http://developer.android.com/guide/components/fragments.html Supporting Multiple Screen: http://developer.android. com/guide/practices/screens_support.html Blog Fragment中文: http://leybreeze.com/blog/?p=902 Merge: http://zhuyonghui116.blog.hexun.com.tw/49165333_d.html Include: http://158067568.iteye.com/blog/932206