Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Android Application Development

You're reading from   Mastering Android Application Development Learn how to do more with the Android SDK with this advanced Android Application guide which shows you how to make even better Android apps that users will love

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher
ISBN-13 9781785884221
Length 298 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Antonio Pachon Antonio Pachon
Author Profile Icon Antonio Pachon
Antonio Pachon
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Fragments

In this section, we are going to review briefly the key concepts of fragments to explain advanced features and components, such as Fragment Manager and the fragments back stack.

In our example, we will create an activity called MainActivity and four fragments: ListFragment, ContactFragment, SettingsFragment, and DetailsFragment. For this, you can create a fragments package and double-click on the package to go to New | Fragment | Blank Fragment. Take a look at the following dialog box:

Fragments

For now, you can create them without the fragment factory methods and the interface callbacks. We will cover these later in the chapter.

Our project so far should look like this in the Project view:

Fragments

Understanding the importance of fragments

A fragment represents a behavior or a portion of the user interface in an activity. You can combine multiple fragments in a single activity to build a multipane UI and reuse a fragment in multiple activities. You can think of a fragment as a modular section of an...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image