tezvyn:

📱Mobile Dev

Mobile app development across platforms

1323 bites

More in Mobile Dev — page 32

`remember` vs. `rememberSaveable`: When and why to use each?
Android & Kotlin2 min read

`remember` vs. `rememberSaveable`: When and why to use each?

Tests understanding of state survival in Compose. A good answer contrasts `remember` (for composition) with `rememberSaveable` (for activity recreation/process death), explaining its use of the `Bundle` mechanism. A red flag is confusing the two lifecycles.

How to implement efficient large lists in Jetpack Compose?
Android & Kotlin2 min read

How to implement efficient large lists in Jetpack Compose?

This tests your grasp of Compose performance. Use `LazyColumn` to compose only visible items, unlike a `Column` which renders all items at once. A red flag is suggesting a scrollable `Column`, which has severe performance costs for large lists.

Which Compose side-effect for a one-time coroutine action?
Android & Kotlin2 min read

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

Tests if you can choose the right Compose side-effect for a one-time coroutine. A great answer names `LaunchedEffect(Unit)`, explains it runs once and cancels on exit. A red flag is suggesting `rememberCoroutineScope` directly in the composable body.

Describe the state hoisting pattern in Compose
Android & Kotlin2 min read

Describe the state hoisting pattern in Compose

Tests your grasp of unidirectional data flow. Explain state hoisting is moving state up to make composables stateless. This enables reusability, easier testing, and a single source of truth. A red flag is just describing the mechanics without the benefits.

Explain Recomposition in Jetpack Compose
Android & Kotlin2 min read

Explain Recomposition in Jetpack Compose

This tests your core understanding of Compose's declarative model. Explain that recomposition is re-running composables when state they read changes. Mention that Compose optimizes by only recomposing the nearest scope and skipping composables with stable…

How do you arrange UI elements in Jetpack Compose?
Android & Kotlin2 min read

How do you arrange UI elements in Jetpack Compose?

Tests your grasp of Compose's declarative layout model. Explain `Row` (horizontal) and `Column` (vertical) as the core layout composables. Define `Modifier` as the standard way to configure size, spacing, and behavior.

What is the purpose of `remember` in Jetpack Compose?
Android & Kotlin2 min read

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

This tests your grasp of Compose's recomposition lifecycle. A good answer explains `remember` caches an object across recompositions, preventing state loss. It's used with `mutableStateOf` to hold the same state instance.

Android & Kotlin2 min read

Explain ConstraintLayout, Chains, and Barriers

Tests your grasp of performant Android UIs. Explain how ConstraintLayout flattens hierarchy, use chains to distribute groups of views (e.g., packed), and use barriers to align elements against dynamic content.

Android Style vs. Theme and Attribute Resolution
Android & Kotlin2 min read

Android Style vs. Theme and Attribute Resolution

Tests your grasp of Android's resource scope and resolution timing. A Style targets a single View, while a Theme applies to a whole Context. `@color/` is a direct, compile-time link; `?attr/` is an indirect pointer resolved against the Theme at runtime.

LinearLayout vs. RelativeLayout vs. FrameLayout
Android & Kotlin2 min read

LinearLayout vs. RelativeLayout vs. FrameLayout

This tests your knowledge of fundamental View layouts and performance trade-offs. Define LinearLayout (single axis), RelativeLayout (relative positioning), and FrameLayout (stacking), giving a clear use case for each.

Android & Kotlin2 min read

ContentProvider Lifecycle During Cross-Process Queries

Tests knowledge of Android's IPC, process management, and threading for ContentProviders. The ContentResolver asks AMS to find/start the provider's process. The provider's onCreate() runs on the main thread, but the query() itself runs on a binder thread.

Bound Service Lifecycle with Config Changes & Multiple Clients
Android & Kotlin2 min read

Bound Service Lifecycle with Config Changes & Multiple Clients

Tests your grasp of bound Service lifecycles. Explain that with BIND_AUTO_CREATE, the Service survives an Activity's config change recreation. It's only destroyed after the *last* client unbinds. A red flag is assuming the Service dies with the first client.

Explain app restoration after Android process death
Android & Kotlin2 min read

Explain app restoration after Android process death

Tests your grasp of process death vs. configuration changes. A good answer explains that the entire app process is recreated, starting with onCreate, and state must be restored from the SavedStateHandle.

Static vs. Dynamic BroadcastReceivers: Implications & Restrictions
Android & Kotlin2 min read

Static vs. Dynamic BroadcastReceivers: Implications & Restrictions

This tests your grasp of Android's background restrictions. Explain that static receivers live with the app but are restricted post-API 26, while dynamic receivers are tied to a component's lifecycle. Ignoring modern API restrictions is a major red flag.

When and why to use a Foreground Service?
Android & Kotlin2 min read

When and why to use a Foreground Service?

Tests your grasp of Android's background execution limits. A great answer explains they're for user-visible tasks like music playback, requires `startForegroundService()`, and must show a notification within 5 seconds.

Describe the back stack for A -> B -> C with singleTask
Android & Kotlin2 min read

Describe the back stack for A -> B -> C with singleTask

Tests understanding of the `singleTask` launch mode. A great answer explains that launching C destroys B, as `singleTask` clears all activities above it in the task. The final back stack becomes [A, C]. A red flag is confusing this with `singleTop`.

How does a ViewModel survive configuration changes?
Android & Kotlin2 min read

How does a ViewModel survive configuration changes?

Tests understanding of lifecycle-aware components. ViewModels are retained by a ViewModelStore owned by the Activity/Fragment, which survives configuration changes. The ViewModel is cleared only when its scope is permanently finished.

Started vs. Bound Services: Differences and Use Cases
Android & Kotlin2 min read

Started vs. Bound Services: Differences and Use Cases

Tests Android component lifecycle and IPC knowledge. A good answer defines lifecycle control (start vs. bind), communication (one-way vs. two-way IBinder), and gives clear use cases. A red flag is assuming services run on a background thread by default.

What happens to an Activity and its text on screen rotation?
Android & Kotlin3 min read

What happens to an Activity and its text on screen rotation?

Tests understanding of configuration changes and state preservation. A great answer explains the Activity is destroyed and recreated, `EditText` state is often saved automatically, but the robust solution is using a `ViewModel` with `SavedStateHandle`.

Trace an Activity's lifecycle when a user navigates away and returns
Android & Kotlin2 min read

Trace an Activity's lifecycle when a user navigates away and returns

This tests your understanding of resource management and state preservation, not just memorization. A great answer traces onPause -> onStop when leaving, and onRestart -> onStart -> onResume when returning, explaining what happens in each.