Working with Fragments on Android – Part 1

  • January 29, 2012 5:20pm CST
  • Posted by Neil Goodman

Fragments were added to the Android SDK when Honeycomb was launched and have since become an important component of modern Android development. This has been helped by the fact that they were also included in the Android Compatibility Library so that OS versions all the way back to Donut could make use of them. Prior to Fragments, an Android app's UI consisted of Activities and Views (sometimes called widgets in the Android documentation). Fragments allow you to break your Activities into smaller re-usable pieces which are easier to manage and allow for a more fluid visual design that can adapt to tablet and phone resolutions. I'm going to go over the basics of using Fragments in this first part of the tutorial.