Android Fragment : Introduction

Mohd Farhan
Jul 28, 2017 · 1 min read
  1. Android Fragment represents a behavior or a portion of user interface in an activity
  2. Multiple fragments can be embedded in a single activity.
  3. Fragment can be used with multiple activities.
  4. Every fragment has its own life cycle.
  5. Fragment can be added/removed while activity is in running state.
  6. Fragment must always be embedded in an activity.
  7. Fragment receives its own input events.

Fragment Life Cycle

Fragment Life Cycle

Why Fragment?

Fragment is new concept introduced in 3.0 version.

  • Modular — Divide complex activity code across fragment to maintain and organize it better
  • Reusable — Fragment can be used with multiple activities to reuse the code.
  • Adaptable — Representing sections of a UI as different fragments and utilizing different layouts depending on screen orientation and size

Next Article —How to create Android Fragments

Mohd Farhan

Written by

Technical Lead @notesgen.com | Machine Learning Enthusiast | Mobile Application Consultant

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade