Book Image

Xamarin Mobile Application Development for Android, Second Edition

Book Image

Xamarin Mobile Application Development for Android, Second Edition

Overview of this book

Table of Contents (18 chapters)
Xamarin Mobile Application Development for Android Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

An introduction to fragments


Fragments are reusable pieces of a user interface component that provide flexibility to the application design. As you have already learnt from Chapter 1, The Anatomy of an Android App, fragments are reusable mini-activities, such as UI components, that can manage their own life cycles. Fragments are always intended to work without depending on another activity or fragment. Like an Activity class, a fragment class needs to extend from the Fragment class. To make things even easier, Android provides some of the additional specialized fragment subclasses such as ListFragment, DialogFragment, and PreferenceFragment.

The following table shows the list of fragment subclasses and their purposes. You may also extend any of the following fragment subclasses to create your own fragment.

ListFragment

This displays a list of data items from different sources, such as an array, a cursor, and so on.

DialogFragment

This displays a fragment as a floating dialog window...