Most Android interviews in 2026 assume you write UI in Jetpack Compose. Teams still maintaining XML views will ask about interop, but the core of the round is Compose: how state drives UI, what triggers recomposition, and how to keep a screen fast. These are the questions I use when running mock interviews with students, with answers short enough to say out loud.
If your Kotlin is shaky, start with the Kotlin interview questions first; Compose leans heavily on lambdas, trailing lambda syntax and delegated properties.
Fundamentals
1. What is Jetpack Compose and how is it different from XML views?
Compose is Android's declarative UI toolkit. You describe what the UI should look like for a given state, in Kotlin functions marked @Composable, and Compose updates the screen when that state changes. With XML views you build a tree once and then mutate it imperatively (textView.text = ...). Compose removes that manual synchronisation between data and widgets, which is where many UI bugs came from.
2. What is a composable function?
A Kotlin function annotated with @Composable. It emits UI rather than returning a view. It can only be called from another composable. Composables should be fast, free of side effects and safe to run in any order, because Compose may call them often, skip them or run them in parallel in future.
@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
Text(text = "Hello, $name", modifier = modifier)
}
Convention worth mentioning: a reusable composable takes a modifier: Modifier = Modifier parameter and applies it to its root.
3. What is recomposition?
When state that a composable reads changes, Compose re-runs that composable (and the parts of its children that depend on it) to produce updated UI. Compose is smart about it: if a composable's parameters are unchanged and stable, it is skipped.
4. What are the three phases of a Compose frame?
Composition (what to show: runs composables and builds the tree), Layout (where to put it: measure and place) and Drawing (how to render it). State read in a later phase only invalidates that phase. Reading a scroll offset inside Modifier.offset { } (the lambda version) or drawBehind { } skips composition entirely, which is a common performance answer.
State
5. How do you hold state in a composable?
@Composable
fun Counter() {
var count by remember { mutableStateOf(0) }
Button(onClick = { count++ }) {
Text("Clicked $count times")
}
}
mutableStateOf creates an observable State. remember keeps it across recompositions. The by delegate needs import androidx.compose.runtime.getValue and setValue. For integers, mutableIntStateOf avoids boxing.
6. What is the difference between remember and rememberSaveable?
remember survives recomposition only. On rotation or other configuration change the activity is recreated and the value is lost. rememberSaveable writes the value to the saved instance state, so it survives configuration changes and process death. It works for types that fit in a Bundle; for others, provide a Saver or use @Parcelize.
Do not put large objects or lists of data in rememberSaveable. Screen data belongs in a ViewModel.
7. What is state hoisting?
Moving state up to the caller and passing down the value plus an event callback:
@Composable
fun SearchBar(query: String, onQueryChange: (String) -> Unit) {
OutlinedTextField(value = query, onValueChange = onQueryChange, label = { Text("Search") })
}
The composable is now stateless. The caller decides where the state lives (a parent composable or a ViewModel). This gives you a single source of truth, and the component is easy to preview and test.
8. What is unidirectional data flow (UDF) in Compose?
State flows down from the ViewModel to composables; events flow up from composables to the ViewModel through callbacks. The UI never changes state directly. This is the pattern Google recommends in its architecture guidance, and it fits naturally with MVVM and MVI (see Android architecture interview questions).
9. How do you connect a ViewModel to a composable?
@Composable
fun ProfileRoute(viewModel: ProfileViewModel = viewModel()) {
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
ProfileScreen(uiState = uiState, onRetry = viewModel::retry)
}
collectAsStateWithLifecycle() (from androidx.lifecycle:lifecycle-runtime-compose) collects the StateFlow only while the lifecycle is at least STARTED. Pass the ViewModel only to the route-level composable; pass plain state and lambdas further down. With Hilt, use hiltViewModel().
10. What is derivedStateOf?
It creates state computed from other state, and only notifies readers when the result actually changes. Classic example: showing a "scroll to top" button.
val listState = rememberLazyListState()
val showButton by remember {
derivedStateOf { listState.firstVisibleItemIndex > 0 }
}
Without derivedStateOf, the composable would recompose on every scroll pixel. With it, only when the boolean flips.
Side effects
11. What is a side effect in Compose and why is it dangerous inside a composable?
Anything that changes state outside the composable's scope: a network call, writing to a database, showing a snackbar, logging analytics. Because composables can run many times, a side effect written directly in the body may run many times. Compose provides effect APIs to control when they run.
12. Explain LaunchedEffect, DisposableEffect, SideEffect and rememberCoroutineScope.
LaunchedEffect(key): launches a coroutine when it enters composition, cancels it when it leaves, and restarts it when a key changes. Use for one-off suspend work tied to the screen.DisposableEffect(key): for work that needs cleanup, such as registering a listener. Must end withonDispose { }.SideEffect: runs after every successful recomposition, to publish Compose state to non-Compose code.rememberCoroutineScope(): a scope bound to the composition, for launching coroutines from event handlers such asonClick.
@Composable
fun LocationTracker(lifecycleOwner: LifecycleOwner = LocalLifecycleOwner.current) {
DisposableEffect(lifecycleOwner) {
val observer = LifecycleEventObserver { _, event ->
if (event == Lifecycle.Event.ON_START) { /* start updates */ }
}
lifecycleOwner.lifecycle.addObserver(observer)
onDispose { lifecycleOwner.lifecycle.removeObserver(observer) }
}
}
13. What is rememberUpdatedState?
When a long-running effect should always use the latest value of a parameter without restarting. For example, a LaunchedEffect(Unit) that waits five seconds then calls onTimeout: wrap onTimeout in rememberUpdatedState so the effect calls the current lambda.
14. What is produceState and snapshotFlow?
produceState turns non-Compose data sources into State by running a coroutine. snapshotFlow { } does the reverse: it turns Compose state reads into a Flow, emitting when the read values change. Useful to send scroll position to analytics with distinctUntilChanged().
Layout and lists
15. How do Modifiers work and why does order matter?
Modifiers decorate a composable and are applied in order, each wrapping the next. Modifier.padding(16.dp).background(Color.Red) gives padding outside the red area; reversing the order paints red behind the padding too. Same for clickable before or after padding, which changes the touch area.
16. What is the difference between Column and LazyColumn?
Column composes every child immediately. LazyColumn only composes and lays out the items visible on screen, like RecyclerView. Use LazyColumn for long or unknown-length lists.
17. Why should you pass key to lazy list items?
LazyColumn {
items(items = users, key = { it.id }) { user ->
UserRow(user)
}
}
Without keys, items are identified by position. If an item is inserted at the top, every item's state (expanded, text input) shifts to the wrong row and more items recompose. A stable key keeps state attached to the right item and enables Modifier.animateItem() for item animations.
18. What is Scaffold?
A Material 3 layout that places a top app bar, bottom bar, floating action button and snackbar host in their slots. Its content lambda gives you PaddingValues; apply them, or your content goes under the bars.
Performance and stability
19. What makes a type stable in Compose?
Compose can skip a composable if all its parameters are stable and unchanged. Stable means Compose can trust equals() and will be told about changes: primitives, String, function types, immutable data classes with stable properties, and types annotated @Stable or @Immutable. A plain List<T> parameter is treated as unstable because the interface could hide a mutable list.
Since strong skipping mode became the default (Compose compiler from Kotlin 2.0.20), composables with unstable parameters can also be skipped, compared by instance equality. Stability still matters, but it is no longer the trap it was in 2022. Saying this shows you are current.
20. How would you find and fix a slow Compose screen?
Talk through a method, not a guess: check it in a release build (debug builds are much slower), use Layout Inspector's recomposition counts to find what recomposes too often, defer state reads to layout or draw phase, use derivedStateOf for frequently changing inputs, add keys to lazy lists, avoid heavy work in composition, and add Baseline Profiles to improve startup and scroll performance.
21. What is CompositionLocal?
A way to pass data implicitly down the tree, like MaterialTheme.colorScheme or LocalContext.current. Create one with compositionLocalOf or staticCompositionLocalOf. Use it sparingly: for cross-cutting values like theme, not for screen data, which should be explicit parameters.
Navigation, theming and interop
22. How do you navigate between screens in Compose?
With Navigation Compose: a NavHost with destinations. Current versions support type-safe routes using @Serializable classes or objects instead of string routes:
@Serializable object Home
@Serializable data class Detail(val id: String)
NavHost(navController, startDestination = Home) {
composable<Home> { HomeScreen(onOpen = { navController.navigate(Detail(it)) }) }
composable<Detail> { entry -> DetailScreen(entry.toRoute<Detail>().id) }
}
Pass IDs between screens, not whole objects, and load the data in the destination's ViewModel. Navigation 3, a newer library built around a back stack you own, is also worth knowing by name.
23. How does theming work with Material 3?
MaterialTheme provides a colorScheme, typography and shapes. Define light and dark colour schemes, and on Android 12+ use dynamicLightColorScheme(context) for wallpaper-based dynamic colour. Components read from the theme, so read MaterialTheme.colorScheme.primary rather than hard-coding colours.
24. How do you use Compose inside an XML app, or a View inside Compose?
ComposeView hosts composables inside a View hierarchy or Fragment. AndroidView hosts a classic View (a MapView, a WebView) inside Compose. This is how most teams migrate screen by screen.
25. How do you test Compose UI?
With createComposeRule() and semantics-based finders:
@get:Rule val composeRule = createComposeRule()
@Test fun counterIncrements() {
composeRule.setContent { Counter() }
composeRule.onNodeWithText("Clicked 0 times").performClick()
composeRule.onNodeWithText("Clicked 1 times").assertIsDisplayed()
}
Use Modifier.testTag where text is not unique. Stateless composables with hoisted state are much easier to test, which ties back to question 7.
How to practise
Build one screen three ways: with local state, with hoisted state, and with a ViewModel exposing StateFlow<UiState>. Then break it on purpose: remove a key from a lazy list, read scroll state in composition, and watch the recomposition counts change. That hands-on experience is what interviewers can tell apart from memorised answers.
Learn Compose hands-on
Our Jetpack Compose training is built around exactly this kind of practice, using Kotlin 2.x and Material 3. For a full path from Kotlin to a published app, see Android training in Chennai, or browse all programs.
K P Ranjith Kumar is a former Google Certified Associate Android Developer and the founder of TechManifester. He has trained Android developers for 12+ years, founded AndroidManifester (now TechManifester) in Chennai in 2016, and builds his own apps with Compose.