Android Fragments for All
Seen 4617 times.
Tagged As: Android
Android 3.0 introduced the Fragment class, intended to represent a behavior or portion of a user interface in an Activity. Since then, Google has released the Android Compatibility package to extend Fragment support to devices running Android 1.6 or later.
Fragments allow you to decompose the functionality and user interface of an application into reusable modules. You can then implement your Activities to assemble difference combinations of Fragments depending on the screen size and orientation of the device—for example, taking advantage of the large screen size of a tablet while still supporting smaller handheld devices.
However, Fragments provide benefits beyond improving your application's support for multiple screen sizes. For example, Fragments allow you to:
- Simplify implementing tabbed interfaces and other dynamic interfaces
- Provide intra-Activity Back button behavior that integrates with the existing Activity back stack
- Easily retain state information across an Activity's runtime configuration change
- Manage an Activity's background processing without a visible user interface component
Download Ken's slides here.