ਇੱਕ Fragment UI ਦਾ ਇੱਕ ਮੁੜ-ਵਰਤੋ ਸਕਣ ਯੋਗ ਹਿੱਸਾ ਹੈ ਜੋ ਇੱਕ Activity ਦੇ ਅੰਦਰ ਮੌਜੂਦ ਹੈ — ਇੱਕ ਮਾਡਿਊਲਰ, ਸਵੈ-ਸਮਾਤ UI ਭਾਗ ਜਿਸ ਦਾ ਆਪਣਾ ਜੀਵਨ-ਚੱਕਰ ਹੈ। Fragments ਲਚਕਦਾਰ, ਮੁੜ-ਵਰਤੋ ਸਕਣ ਯੋਗ UIs ਨੂੰ ਸਮਰੱਥ ਬਣਾਉਂਦੇ ਹਨ ਅਤੇ ਆਧੁਨਿਕ ਸਿੰਗਲ-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.
