Member-only story
🚀 Android Interview Questions Series Part 5: 2025
If you have missed Part 1–5, please catch up soon. Today, we will focus on the latest and must-know questions of Android which are asked in every interview. Come on, let’s polish our coding skills!
If you have missed previous parts, you can find them here: Part 1, Part 2, Part 3, and Part 4.
1️⃣ When and why to use remember
and mutableStateOf
in Jetpack Compose?
Answer: remember
is used to retain the state during UI recomposition. mutableStateOf
tracks state changes and triggers recompose.
Example:
var count by remember { mutableStateOf(0) }
Button(onClick = { count++ }){
Text("Count: $count")
}
Tip: Think of remember
as the ‘brain’ that remembers the things(values), and mutableStateOf
as the ‘alarm bell’ that updates the UI!
2️⃣ How to choose between LaunchedEffect
vs rememberCoroutineScope
in Compose?
Answer:
LaunchedEffect
: For single async task (like API call when a screen is launched). Basically, launchedEffect is called only for the first time where it is defined or only when some change in the key.
rememberCoroutineScope
: To launch the coroutine for UI events (button click). This is preferred when need to perform some event, also it provides us a scope that we can handle according to our…