Skip to content
tezvyn:

All bites

The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.

4330 bites

Page 197

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.

How does a ViewModel survive configuration changes?
Android & Kotlin2 min 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.

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

Describe the back stack for A to B to C with singleTask

Tests singleTask plus taskAffinity, not rote memorization. With default affinity, C sits atop B in the same task; if C already existed, the system clears B and delivers onNewIntent. Red flag: claiming singleTask always spawns a new task.

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.

singleTask Launch Mode: A -> B -> C Back Stack
Android & Kotlin2 min 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.

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.

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.

When and why use a Foreground Service on modern Android?
Android & Kotlin2 min 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.

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.

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.

Static vs. Dynamic BroadcastReceivers: Implications and Restrictions
Android & Kotlin2 min 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.

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.

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.

Handle Android Process Death vs. Configuration Changes
Android & Kotlin2 min 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.

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.

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.

Bound Service Lifecycle: Config Changes and Multiple Clients
Android & Kotlin2 min 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 & 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.

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.

Android & Kotlin2 min read

How does Android manage a ContentProvider's lifecycle during a query?

This tests your understanding of Android IPC and component lifecycles. Explain how ContentResolver uses a URI to have the system instantiate the provider in its own process.