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 ...
Get Learning Android™ Application Programming: A Hands-On Guide to Building Android Applications 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.