4.11 Wrap-Up

In this chapter, you built a Flag Quiz app that tests a user’s ability to correctly identify country flags. A key feature of this chapter was using Fragments to create portions of an Activity’s GUI. You used two activities to display the MainActivityFragment and the SettingsActivityFragment when the app was running in portrait orientation. You used one Activity to display both Fragments when the app was running on a tablet in landscape orientation—thus, making better use of the available screen real estate. You used a subclass of PreferenceFragment to automatically maintain and persist the app’s settings and a subclass of DialogFragment to display an AlertDialog to the user. We discussed portions of a Fragment’s lifecycle and showed ...

Get Android How to Program, 3/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.