Thuta Learning
ExercisesMobile Developmentintermediate

Practice Round 1

Relax. We'll talk through this in plain words — no textbook voice.

What you'll walk away with

  • Understand Practice Round 1 without any of the intimidation
  • Be able to run Android Studio/Compose code yourself
  • Apply this concept straight away in a real project

Let's think about it this way for a second

This round is about putting the Basic/Intermediate concepts you've already learned back into practice — telling Composable/State/Modifier apart, hunting down errors in Compose code, and using `remember` correctly are all things you'll do hands-on. No single task should take more than 5 minutes.

Let's connect this to a real scenario

Task 1: Explain the job of each of the three — '@Composable function', 'State (remember)', and 'Modifier' — in one sentence each. Task 2: Write `var count = 0` (no remember) inside a Composable function, imagine a Button that does `count++` on click, and predict what happens. Task 3: Write down, with an example, when you should reach for LazyColumn instead of Column. Task 4: If rotating the screen can wipe out `remember` state, which solution should you use?

Let's look at it together

text
# Task 2 - state without remember
var count = 0   // NOT wrapped in remember!

Button(onClick = { count++ }) { Text("Count: $count") }

Result: clicking the button triggers recomposition, but
since `count` is a plain local variable (not remember'd),
it resets to 0 every time recomposition runs — the UI
never visibly changes past "Count: 1" (it recomposes
before you can see anything higher).

# Task 4 - surviving rotation
Use rememberSaveable instead of remember for state that
must survive a configuration change (screen rotation).
You should see
You'll come away with a clear grasp of the Composable/State/Modifier distinction, the remember-less state bug, and when to reach for rememberSaveable.

Try it in 5 minutes

Write your own Composable, deliberately leave out `remember`, and let a state bug slip in — run it and see for yourself what happens.

One thing to watch out for

You don't need a physical device set up for this round — just focus your practice on the emulator (or the Preview panel).

Easy traps

  • Getting Composable/State/Modifier mixed up and treating them as 'basically the same thing'
  • Skimming past a Compose error message in the terminal/Logcat without checking which line it points to

Now try it yourself

Write your own Composable, deliberately leave out `remember`, and let a state bug slip in — run it and see for yourself what happens.

You'll know it worked when: You'll come away with a clear grasp of the Composable/State/Modifier distinction, the remember-less state bug, and when to reach for rememberSaveable.

Practice Round 1 | Thuta Learning