Learning Android™ Application Programming: A Hands-On Guide to Building Android Applications
by James Talbot, Justin McLean, Jorge Hernandez
Using Fragments
Fragments can be thought of as subactivities. Fragments are useful if you want to reuse part of the UI in different activities, or layouts, in an app. They can be particularly useful when you’re making layouts intended for viewing on large (physical) screen mobile devices, because you can easily place fragments side by side. They also help in making your application easier to maintain by reducing duplication of code between layouts.
Fragments are also useful when you’re customizing your app for different countries or locales. It’s often simpler to break a UI into fragments and reuse the fragments for tweaks to the layouts or UI component differences in different countries or locales. Once you start supporting many locales, if ...
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