Skip to content

Lesson 06 · Android with Kotlin & Compose

Android Capstone — Build & Test a Notes App

Five lessons of pieces become one app: this capstone assembles a Notes app end to end - a Room-backed data layer, a repository mediating between the DAO and a DataStore sort-order preference, a ViewModel exposing one immutable UiState as a StateFlow, and two Compose screens that render it - then makes it shippable: unit-tested, UI-tested, accessibility-checked, signed and bundled for the Play Console's internal testing track.

Prerequisites: Android: Room, DataStore & Permissions

Learning objectives
By the end of this lesson, you will be able to:
  • Assemble a complete app from the layers you have met separately - Room entity, DAO and database underneath; a repository combining the DAO with a DataStore-backed sort preference; a ViewModel exposing one immutable UiState as a StateFlow; Compose screens that render it - with every dependency pointing one way, from the UI down to the data
  • Join data sources with Flow operations: flatMapLatest switching queries when the sort preference changes, combine folding notes, order and query into a single UiState, and stateIn sharing it with a five-second grace period for collectors that come and go
  • Test at the right layer - plain JUnit for pure mapping logic, with the clock passed in so time-dependent branches are deterministic, and createAndroidComposeRule with semantic matchers for the screens, waiting honestly for asynchronous saves
  • Pass the accessibility bar - contentDescription on every icon-only control, 48dp minimum touch targets, and a TalkBack walkthrough that reads the list and the editor sensibly from top to bottom
  • Prepare a release the safe way - bundleRelease for the .aab, the keystore treated as the app's identity and kept out of version control, the Play Console's internal testing track as the first destination for the artifact - while staying precise about what this browser environment can and cannot verify