एक Fragment UI का एक पुनः उपयोग योग्य हिस्सा है जो किसी Activity के भीतर रहता है — अपने स्वयं के lifecycle वाला एक modular, self-contained UI component। Fragments flexible, पुनः उपयोग योग्य UIs को सक्षम करते हैं और आधुनिक single-Activity architectures के केंद्र में हैं।
Fragment क्या है
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.
