tezvyn:

Android & Kotlin

Jetpack Compose, Android Studio, Kotlin, Material You

243 bites

Android & Kotlin30 sec read

How to pass data between Fragments with Jetpack Navigation?

This tests your knowledge of type-safe argument passing in Jetpack Navigation. A good answer defines the argument in XML, uses the Safe Args plugin to generate code, passes data via the Directions class, and retrieves it with the Args class.

Android & Kotlin30 sec read

Explain ViewModel, Repository, and Data Source in MVVM

This tests your grasp of separation of concerns in Android. A good answer defines ViewModel, Repository, and Data Source roles, then traces the unidirectional data flow. A red flag is having the ViewModel directly access a data source like Retrofit.

Android & Kotlin30 sec read

What problem does Jetpack ViewModel solve during configuration changes?

This tests your understanding of state loss during configuration changes. A good answer explains that Activities are destroyed on rotation, and ViewModel survives this event, preserving UI state.

Android & Kotlin30 sec read

How do you diagnose and fix excessive recomposition in Jetpack Compose?

This tests your understanding of Compose's stability system for performance. Use the Layout Inspector and Compiler Metrics to find unstable composables, then fix them with immutable data types and stable lambdas.

Android & Kotlin30 sec read

remember vs. rememberSaveable: When and Why to Use Each

Tests understanding of Compose state survival. `remember` is for recomposition scope. `rememberSaveable` survives activity recreation and process death via a `Bundle`, requiring custom `Saver`s for complex types. Red flag: saying `remember` survives rotation.

Android & Kotlin30 sec read

Implement an efficient list in Jetpack Compose

Tests your grasp of UI virtualization in Compose. Answer: Use `LazyColumn` as it only composes visible items. Contrast this with `Column`, which composes all items at once, causing poor performance. Mention the `items` DSL.

Android & Kotlin30 sec read

Which side-effect handler for a one-time coroutine action in Compose?

This tests your understanding of Compose lifecycles and side-effect handlers. A good answer names `LaunchedEffect(Unit)`, explaining the constant key ensures the effect runs only once. A red flag is suggesting launching coroutines on every recomposition.

Android & Kotlin30 sec read

Describe state hoisting in Jetpack Compose.

Tests your grasp of unidirectional data flow. Explain state hoisting is moving state up to make composables stateless. This improves reusability, testability, and creates a single source of truth. A red flag is defining it without explaining the benefits.

Android & Kotlin30 sec read

Explain Recomposition in Jetpack Compose

Tests your grasp of Compose's declarative model. A good answer defines recomposition, explains state-read triggers, and details how stability and positional memoization enable skipping. A red flag is assuming any state change redraws the entire UI.

Android & Kotlin30 sec read

How to arrange UI elements in Jetpack Compose?

This tests your grasp of Compose's declarative layout basics. A good answer defines Column (vertical) and Row (horizontal) for structure, and Modifier for decoration, size, and behavior. A red flag is confusing Modifiers with simple styling.

Android & Kotlin30 sec read

What is the purpose of the `remember` function in Compose?

This tests your grasp of recomposition. Explain that `remember` stores an object in the composition tree, preventing it from being re-initialized on every render. A red flag is confusing it with `rememberSaveable`, which survives configuration changes.

Android & Kotlin30 sec read

Styles vs. Themes and Attribute Resolution in Android

This tests your grasp of Android's resource indirection. A Style is a set of attributes for one View type. A Theme is a collection of named attributes for an app or Activity. `?attr` is resolved at runtime against the Theme, while `@color` is a direct.

Android & Kotlin30 sec read

LinearLayout vs. RelativeLayout vs. FrameLayout: Explain and give use cases

Tests your grasp of classic Android layouts and performance trade-offs. A good answer defines each, gives a clear use case, and mentions `layout_weight`. A red flag is proposing nested `LinearLayout`s for complex UIs, ignoring performance.

Android & Kotlin30 sec read

Bound Service Lifecycle: Config Changes and Multiple Clients

Tests deep knowledge of bound service lifecycles. A config change causes an unbind/rebind cycle, recreating the service. With multiple clients, the service isn't destroyed until the last one unbinds. Red flag: assuming the service survives the config change.

Android & Kotlin30 sec read

Handle Android Process Death vs. Configuration Changes

Tests your grasp of Android's lifecycle for state restoration. A good answer explains that `onCreate(savedInstanceState)` is called in both cases, but process death recreates everything. Use `ViewModel` with `SavedStateHandle`.

Android & Kotlin30 sec read

Static vs. Dynamic BroadcastReceivers: Implications and Restrictions

This tests your knowledge of Android's background execution limits. A good answer defines static and dynamic registration, explains the restrictions since Android 7/8, and gives use cases. A red flag is ignoring the modern API limitations.

Android & Kotlin30 sec read

When and why use a Foreground Service on modern Android?

Tests understanding of background work restrictions. A great answer defines the use case for user-visible tasks, explains the mandatory notification, and details the `startForegroundService()` flow.

Android & Kotlin30 sec read

singleTask Launch Mode: A -> B -> C Back Stack

This tests your understanding of Android's `singleTask` launch mode and task management. A good answer explains that A and B form a stack in one task, while C launches into a new, separate task, becoming its root.

Android & Kotlin30 sec read

How does a ViewModel survive configuration changes?

Tests understanding of ViewModel's scope, separate from the Activity lifecycle. A ViewModel is retained by a ViewModelStore, which persists across configuration changes. The new Activity instance then reconnects to the same ViewModel.

Android & Kotlin30 sec read

Started vs. Bound Services: Differences and Use Cases

Tests your grasp of Android component lifecycles. A strong answer defines each by its lifecycle control (who starts/stops it) and communication pattern (fire-and-forget vs. client-server), then gives distinct use cases.