To create a dynamic and multi-pane user interface on Android, you need to encapsulate
UI components and activity behaviors into modules that you can swap into and out of
your activities. You can create these modules with the
Fragment class, which
behaves somewhat like a nested activity that can define its own layout and manage its own
When a fragment specifies its own layout, it can be configured in different combinations with other fragments inside an activity to modify your layout configuration for different screen sizes (a small screen might show one fragment at a time, but a large screen can show two or more).
This class shows you how to create a dynamic user experience with fragments and optimize your app's user experience for devices with different screen sizes, all while continuing to support devices running versions as old as Android 1.6.
- Using the Android Support Library
- Learn how to use more recent framework APIs in earlier versions of Android by bundling the Android Support Library into your app.
- Creating a Fragment
- Learn how to build a fragment and implement basic behaviors within its callback methods.
- Building a Flexible UI
- Learn how to build your app with layouts that provide different fragment configurations for different screens.
- Communicating with Other Fragments
- Learn how to set up communication paths from a fragment to the activity and other fragments.