Compose
Fundamentals & Recomposition
Explain the difference between
rememberandrememberSaveableand when each is appropriate.What triggers recomposition in Compose, and how does the compiler optimize it via stability inference?
How do
@Stable,@Immutable, and@NonRestartableComposableannotations affect recomposition behavior?Why is it problematic to pass unstable types (e.g.,
ArrayList,ViewModel) directly into Composable parameters?What is the role of
SnapshotStateand how does it integrate with Compose's observation system?Explain the difference between
derivedStateOfandremember(key)— when would you choose one over the other?What happens if you write
var text by remember { mutableStateOf("") }inside a Composable versus hoisting it to a ViewModel?
State Management & Architecture
How do you implement unidirectional data flow in a Compose-heavy application?
What are the trade-offs between
ViewModelstate holders versus plain class state holders in Compose?How do you handle configuration changes (e.g., rotation) with Compose state without relying on
ViewModel?Describe the purpose and limitations of
CompositionLocal— when is it appropriate to use versus avoid?How would you share state between sibling Composables without passing callbacks through multiple layers?
What is the difference between
produceState,collectAsState, andcollectAsStateWithLifecycle?How do you gracefully handle process death and restoration with Compose Navigation?
Performance & Optimization
What is the "donut-hole skipping" optimization in Compose, and how do you ensure your code benefits from it?
How does
LazyColumndiffer fromRecyclerViewin terms of item recycling and composition strategy?What is the cost of using
Modifierchains extensively, and how do you optimize them?When should you use
keyinLazyColumnorLazyRow, and what happens if you omit it?How do you debug and fix recomposition loops or excessive recompositions in a large screen?
Explain the impact of using
BoxWithConstraintsorSubcomposeLayouton performance.What tools do you use to measure Compose frame times and recomposition counts in production?
Custom Layouts & Graphics
How would you build a custom layout using
Layoutcomposable? What areMeasurePolicyandIntrinsicMeasurable?What is the difference between
SubcomposeLayoutand the standardLayoutcomposable?How do you create a custom
ModifierusingModifier.Nodeversus the olderModifier.composedapproach?Explain how
DrawScopeandCanvaswork in Compose — how do you handle touch events on custom drawn elements?How would you implement a staggered grid layout before
LazyVerticalStaggeredGridexisted in Compose?
Navigation & Deep Linking
How does Compose Navigation differ from the Fragment-based Navigation Component in terms of lifecycle and back stack?
How do you handle nested navigation graphs with independent back stacks in Compose?
What are the challenges of using type-safe navigation with Compose Navigation, and how do you implement it?
How do you manage screen transitions and shared element transitions between destinations in Compose Navigation?
Explain how you would implement a bottom navigation bar with multiple back stacks using Compose Navigation.
Interoperability & Migration
How do you embed a
Viewinside Compose and vice versa? What are the lifecycle implications?What is
AndroidViewand when should you prefer it over rewriting a custom view in Compose?How do you gradually migrate a large XML-based codebase to Compose without a full rewrite?
What are the challenges of using Compose inside
RecyclerVieworViewPager2?How do you handle
WindowInsetswhen mixing Compose and legacy View-based screens?
Testing
How do you write unit tests for Composables? What is the role of
createComposeRule?What is semantic testing in Compose, and how do you use
SemanticsMatcherandSemanticsNodeInteraction?How do you test state hoisting and verify that state changes trigger recompositions correctly?
What are the limitations of Compose UI testing compared to Espresso, and how do you work around them?
How do you perform screenshot or visual regression testing for Compose UIs?
Animation & Gestures
Explain the difference between
animate*AsState,updateTransition, andAnimatedContent.How do you implement a draggable list item with reordering in Compose?
What is the difference between
pointerInputandModifier.draggable/Modifier.swipeable/Modifier.anchoredDraggable?How do you coordinate animations across multiple Composables using
Animatableand coroutines?How would you implement a shared element transition between two screens in Compose?
Theming & Design Systems
How do you build a multi-theme design system in Compose that supports dynamic color, light/dark mode, and brand themes?
What is the role of
CompositionLocalProviderin theming, and how do you avoid overusing it?How do you handle typography scaling and accessibility font sizes gracefully in Compose layouts?
How do you implement a custom ripple effect or remove the default ripple in Material3 Compose?
Build & Tooling
What Compose compiler metrics do you monitor (e.g.,
reportsDestination), and how do you act on them?How does the Compose Compiler plugin differ from standard Kotlin compilation, and what version alignment issues have you encountered?
What is the impact of enabling/disabling
strongSkippingmode in the Compose compiler?How do you manage Compose version alignment across a multi-module project with different teams?
System & Edge Cases
How do you handle
SurfaceVieworTextureViewcontent (e.g., camera, video) within a Compose layout?What are the implications of using Compose in a
ServiceorWidgetcontext (e.g., Glance)?How do you manage memory leaks in Compose, particularly with
rememberholding references to lifecycle-bound objects?How do you implement a responsive layout that adapts to foldable devices or large screens using Compose?
What is the
Recomposerand when would you need to interact with it directly?How do you handle text input fields with complex formatting (e.g., credit cards, phone numbers) in Compose?
Last updated