tezvyn:

📱Mobile Dev

Mobile app development across platforms

1323 bites

More in Mobile Dev — page 29

Why is LiveData<Boolean> problematic for one-time ViewModel events?
Android & Kotlin2 min read

Why is LiveData<Boolean> problematic for one-time ViewModel events?

WHAT IT TESTS: LiveData replays one-time events after rotation. A GOOD ANSWER COVERS: State is not events; suggest an Event wrapper with a consumed flag, or SharedFlow or Channel with no replay. RED FLAG: Praising SingleLiveEvent or onCleared resets as fix.

How do you pass data between Fragments with Jetpack Navigation?
Android & Kotlin2 min read

How do you pass data between Fragments with Jetpack Navigation?

WHAT IT TESTS: Type-safe argument flow in Navigation. ANSWER OUTLINE: Define args in nav graph XML, navigate with generated Directions, read with navArgs() in target Fragment. RED FLAG: Direct Fragment constructors, manual Bundles, or Activity Intent extras.

Explain the roles of ViewModel, Repository, and data source in MVVM
Android & Kotlin2 min read

Explain the roles of ViewModel, Repository, and data source in MVVM

Tests your grasp of unidirectional data flow and separation of concerns in Android MVVM. A strong answer maps ViewModel to UI state, Repository to data coordination, and Room or Retrofit to I/O.

What is a ViewModel and what lifecycle problem does it solve?
Android & Kotlin86 sec read

What is a ViewModel and what lifecycle problem does it solve?

Tests config-change survival: ViewModel outlives Activity recreation so state survives rotation. Strong answer notes it holds non-serializable data and separates concerns, but does not survive process death.

Diagnose Compose recomposition issues and explain lambda stability
Android & Kotlin2 min read

Diagnose Compose recomposition issues and explain lambda stability

Tests Compose skipping and stability. Strong answers name recomposition counts, compiler metrics, and immutable state, then explain unremembered lambdas create new instances and prevent skipping.

Difference between remember and rememberSaveable
Android & Kotlin2 min read

Difference between remember and rememberSaveable

WHAT IT TESTS: Compose state vs saved state. ANSWER OUTLINE: remember survives recompositions only; rememberSaveable uses Bundle state for config changes and process death; use for UI state after recreation. RED FLAG: Claiming it uses ViewModel or disk.

How do you display a large list efficiently in Jetpack Compose?
Android & Kotlin2 min read

How do you display a large list efficiently in Jetpack Compose?

This tests understanding of Compose lazy versus eager layout. A strong answer names LazyColumn or LazyRow, notes visible-only composition, and contrasts Column which lays out everything upfront.

Which side-effect handler for a one-time coroutine on composition entry?
Android & Kotlin2 min read

Which side-effect handler for a one-time coroutine on composition entry?

Tests Compose side-effect API boundaries. Answer: LaunchedEffect(Unit); it runs once and auto-cancels on exit. Contrast with rememberCoroutineScope for user-triggered callbacks. Red flag: picking SideEffect or rememberCoroutineScope and missing cancellation.

Describe state hoisting and its benefits in Compose
Android & Kotlin2 min read

Describe state hoisting and its benefits in Compose

WHAT IT TESTS: Understanding unidirectional data flow in declarative UI. ANSWER OUTLINE: Move state to the caller, pass value and event lambda down, keep them stateless. RED FLAG: Internal state in reusable composables or calling hoisting boilerplate.

Explain Jetpack Compose recomposition, its triggers, and optimizations.
Android & Kotlin2 min read

Explain Jetpack Compose recomposition, its triggers, and optimizations.

This tests grasp of Compose's reactive model. A strong answer defines recomposition as recomputing composables when state changes, notes State triggers it, and explains Compose skips unchanged subtrees via smart tracking.

Arrange UI elements vertically or horizontally in Jetpack Compose
Android & Kotlin2 min read

Arrange UI elements vertically or horizontally in Jetpack Compose

Tests declarative layout fundamentals. Good answers name Column and Row, explain Modifier as an ordered chain of decoration and layout behavior, and note order changes semantics. Red flag: calling Modifier "just styling" or confusing it with LinearLayout.

What is remember in Compose and how do you use mutableStateOf?
Android & Kotlin2 min read

What is remember in Compose and how do you use mutableStateOf?

This tests state survival across recompositions. Good answers say remember caches values across recompositions, pairs with mutableStateOf for observable state, and shows a counter. A red flag is mutableStateOf without remember, state resets per recomposition.

Android & Kotlin2 min read

How does ConstraintLayout enable flat responsive UIs with chains and barriers?

It tests constraint-based positioning and flat hierarchy performance. A strong answer covers relative constraints replacing nested layouts, chains for distributing groups, and barriers for dynamic alignment to extreme edges.

Difference between Style and Theme, and how ?attr/ resolves vs @color/
Android & Kotlin2 min read

Difference between Style and Theme, and how ?attr/ resolves vs @color/

Probes Android resource indirection depth. A style targets one View; a theme targets a Context. ?attr/ resolves dynamically against the current theme at runtime, but @color/ is a static compile-time constant. Red flag: saying both resolve the same way.

Explain the difference between LinearLayout, RelativeLayout, and FrameLayout
Android & Kotlin2 min read

Explain the difference between LinearLayout, RelativeLayout, and FrameLayout

Understanding of ViewGroup measurement and simplicity versus flexibility tradeoffs. LinearLayout for 1D lists, RelativeLayout for complex sibling rules, FrameLayout for single-child or overlap.

Android & Kotlin2 min read

How does Android manage ContentProvider lifecycle and threading across processes?

Tests Android IPC and provider architecture. Strong answers explain lazy per-process instantiation via AMS, ContentResolver as the client binder proxy, and query executing on a binder thread. Red flag: claiming the provider runs in the caller process.

What happens to a bound service during config changes and multiple clients?
Android & Kotlin2 min read

What happens to a bound service during config changes and multiple clients?

Tests bound service reference counting. Config change destroys the Activity binding; if no other clients exist, the service stops. Multiple clients keep it alive until the last unbind. Red flag: assuming the service survives config changes without a rebind.

Your app is killed for memory; what runs when the user returns?
Android & Kotlin2 min read

Your app is killed for memory; what runs when the user returns?

Tests process death versus config change. Answer: no callback on kill; return runs onCreate with savedInstanceState, onStart, and onResume. ViewModels die in process death; use SavedStateHandle. Red flag: claiming onDestroy fires or ViewModels survive it.

Static vs dynamic BroadcastReceiver registration and modern Android implications
Android & Kotlin2 min read

Static vs dynamic BroadcastReceiver registration and modern Android implications

Tests background limits, lifecycle coupling. Static manifest receivers survive app death but API 26 blocks most implicit broadcasts; dynamic receivers run with the context and must be unregistered. Red flag: static registration handles all implicit broadcasts.

When and why use a Foreground Service on API 26+?
Android & Kotlin2 min read

When and why use a Foreground Service on API 26+?

Tests background execution limits. Good answer: use for noticeable long-running work; declare FOREGROUND_SERVICE, show a notification, and respect API 26 background start limits. Red flag: calling it invisible work or omitting the notification.