Notes app for Android (Kotlin, Room)
A clean notes app with a local database, search and colours, built with today's Android tools.
What you'll learn
- โJetpack Compose UI
- โRoom database and DAOs
- โViewModel and StateFlow (MVVM)
What you'll build
- โCreate, edit, delete notes
- โSearch
- โNote colours and pinning
- โWorks offline
Step-by-step guide
- 1
New project
Android Studio โ Empty Activity (Compose). Add Room dependencies with KSP.
- 2
Entity and DAO
@Entity data class Note(@PrimaryKey(autoGenerate = true) val id: Int = 0, val title: String, val body: String, val color: Int, val pinned: Boolean, val updatedAt: Long); @Dao with Flow<List<Note>> queries.
- 3
Database
@Database(entities = [Note::class], version = 1) and a single instance via Room.databaseBuilder.
- 4
ViewModel
Expose notes as StateFlow from the DAO's Flow with stateIn; functions save() and delete() using viewModelScope.launch.
- 5
List screen
LazyColumn of note cards; pinned first; a search TextField filtering the list.
- 6
Edit screen
Navigation Compose route edit/{id}; save when leaving the screen.
- 7
Polish
Swipe to delete with an Undo Snackbar; dark theme support.
๐ Make it stand out
- +Reminders with WorkManager notifications
- +Back up to the cloud
- +Home-screen widget