Fragment ni sehemu ya UI inayoweza kutumika tena inayoishi ndani ya Activity — kipengele cha UI cha kimoduli, kinachojitegemea chenye mzunguko wake wa maisha. Fragments huwezesha violesura vinavyonyumbulika, vinavyoweza kutumika tena na ni muhimu kwa miundo ya kisasa ya Activity-moja.
Fragment ni nini
A FRAGMENT = a reusable, modular piece of UI hosted inside an Activity:
→ has its OWN lifecycle (tied to but distinct from the host activity's)
→ multiple fragments can be combined in one activity; reused across activities
→ represents a portion of the screen (or a whole screen's content)
→ Think: an activity can host one or more fragments that make up its UI.
