0PricingLogin
Jetpack Compose Academy · Lesson

Build a Tap Counter

Wire state to a button for live updates.

Our Goal

Let's build a tiny tap counter: a number on screen and a button that increases it with every tap. 🙂

Start With the State

First declare the state that will change. The counter starts at zero and lives inside the Composable for now.

var count by remember { mutableStateOf(0) }

All lessons in this course

  1. remember & mutableStateOf
  2. Recomposition: What Triggers a Redraw
  3. Build a Tap Counter
  4. rememberSaveable Across Rotation
← Back to Jetpack Compose Academy