Android Architecture Components (del af Jetpack) er biblioteker, der hjælper med at bygge robuste, vedligeholdelige apps — herunder ViewModel (livscyklus-bevidst tilstand), LiveData/StateFlow (observerbar data) og Room (en databaseabstraktion). De understøtter anbefalede arkitekturmønstre.
ViewModel — livscyklus-bevidst tilstandsholder
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)
