← Android App Development (Kotlin) learning pathAndroid App Development (Kotlin) · Module 8 of 10
Local data: Room and DataStore
Store data on the device.
📖 Key ideas
- Room is an SQLite abstraction: @Entity, @Dao, @Database.
- DAOs define queries: @Query("SELECT * FROM notes").
- Room can return Flow so UI updates automatically.
- DataStore stores small key-value settings (replaces SharedPreferences).
- Use offline-first: cache network data locally.
💡 Real-life example: Room is a filing cabinet in the phone; DataStore is a sticky note for small settings.
RoomSQLite database library
@DaoData Access Object interface
DataStoreModern key-value storage
Offline-firstApp works from local data first