Android Architecture Components (Jetpack کا حصہ) libraries ہیں جو مضبوط، قابل رکھ رکھاؤ apps بنانے میں مدد دیتی ہیں — جن میں ViewModel (lifecycle-aware state)، LiveData/StateFlow (observable data)، اور Room (database abstraction) شامل ہیں۔ یہ سفارش کردہ architecture patterns کو support کرتے ہیں۔
ViewModel — lifecycle-aware state holder
VIEWMODEL holds UI-related state and logic, SURVIVING configuration changes:
→ state stored in a ViewModel SURVIVES screen rotation (the activity recreates, but the
ViewModel persists) → solves the lost-state-on-rotation problem
→ separates UI logic from the Activity/Fragment (the View just observes/displays)
