Android » Fragments

In my previous Android development posts I had pretty detailed notes on the respective development guide. From here on out I will be moving away from that and instead be recording smaller notes, highlighting only what information can be found in the main texts. The old way made reading the material take 5+ times longer to read and therefore was actually diminishing how much I was learning per hour. For my current purposes (developing a basic Android app) it is more important that I get a general idea of the development process and possibilities in functions and all that rather than memorizing all the specifics.

Anyways, in this topic I’ll

be noting the key points from the Fragments guide.

Fragments

  • Represents a behavior or a portion of UI in an Activity.
  • Can combine multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple activities.
  • Must always be embedded in an activity so their lifecycles are directly related.
  • Management of fragment lifecycles is very similar to that of activities.
  • Gives the ability to add, remove, replace, and perform other actions with them in response to user interaction.
  • Fragments can contribute menu items to the activity’s Options Menu.

Design Philosophy


  • Fragments were introduced to support dynamic and flexible UI designs on large screens without having to manage a complex view hierarchy.
  • Can embed multiple fragments in an activity so that users with larger screens can see more of the UI at once.

Leave a Reply

Your email address will not be published. Required fields are marked *