Android Architecture Components (del av Jetpack) är bibliotek som hjälper till att bygga robusta, underhållbara appar — inklusive ViewModel (tillståndshantering medvetenhet om livscykel), LiveData/StateFlow (observerbar data) och Room (en databasabstraktion). De stöder rekommenderade arkitekturmönster.
ViewModel — tillståndshantering medvetenhet om livscykel
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)
