Android Architecture Components (Jetpack の一部) は、堅牢で保守性の高いアプリを構築するためのライブラリです。ViewModel (ライフサイクル対応の状態管理)、LiveData/StateFlow (監視可能なデータ)、Room (データベース抽象化) が含まれ、推奨アーキテクチャパターンをサポートします。
ViewModel — ライフサイクル対応の状態ホルダー
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)
