A Fragment एक पुनः प्रयोजनयोग्य UI को भाग हो जो एक Activity को भित्र बस्छ — एक मोड्युलर, आत्मनिर्भर UI घटक यसको आफ्नै lifecycle सहित। Fragments लचकदार, पुनः प्रयोजनयोग्य UIs सक्षम गर्छन् र आधुनिक single-Activity आर्किटेक्चरको केन्द्रबिन्दु हुन्।
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.
Fragments बनाम Activities
ACTIVITY → a top-level screen/entry point; heavier; managed by the OS; declared in manifest
FRAGMENT → a UI portion WITHIN an activity; lighter, reusable, modular; managed by the
activity's FragmentManager; NOT declared in the manifest
→ Fragments are more flexible/reusable; activities are the containers/entry points.
