5.3.2. Fragments
A fragment typically represents a reusable portion of an Activity’s user interface, but may also represent reusable program logic. This app uses fragments to create and manage portions of the app’s GUI. You can combine several fragments to create user interfaces that take advantage of tablet screen sizes. You also can easily interchange fragments to make your GUIs more dynamic—you’ll learn about this in Chapter 8.
Fragment (package android.app) is the base class of all fragments. The Flag Quiz app defines the following direct and indirect Fragment subclasses:
• Class QuizFragment (Section 5.6)—a direct subclass of Fragment—displays the quiz’s GUI and defines the quiz’s logic. Like an Activity, each Fragment has its own layout ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access