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

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?
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
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?
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
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.
Managing Sensitive Information in Gradle Builds
Tests secure credential handling in Android builds. A good answer uses a git-ignored .properties file, the secrets-gradle-plugin to parse it, and accesses keys via BuildConfig. A red flag is storing keys directly in build.gradle or committing them.

How do you diagnose a memory leak using the Android Studio Profiler?
This tests your practical skill with the Android Memory Profiler, not just theory. A great answer involves capturing a heap dump, filtering for unreachable objects, and inspecting the reference tree to find the leak's source.

Explain Gradle Build Types vs. Product Flavors
Tests your grasp of Gradle's build matrix. A great answer defines build types for lifecycle (debug/release) and product flavors for user-facing versions (free/paid), then explains how they combine into variants.

What is ADB and what are two common commands you use?
Tests your hands-on familiarity with the core Android toolchain. Define ADB's client-server architecture, then explain adb install for APKs and adb logcat for logs. A red flag is being unable to name specific commands or only knowing IDE buttons.

Which tool inspects the view hierarchy to debug layouts?
This tests your knowledge of core Android Studio debugging tools. A great answer names the Layout Inspector, describes its 3D component tree and attributes pane, and notes its live update capability on API 29+. A red flag is only mentioning XML files.

What is a Gradle product flavor?
This tests your understanding of build variants beyond debug/release. Define flavors for user-facing versions (free/pro), contrast with build types, and configure with applicationIdSuffix and buildConfigField.

How would you debug an app crash in Android Studio?
This tests your systematic debugging process. A good answer starts with Logcat to find the stack trace, then uses breakpoints to inspect program state *before* the crash occurs. A red flag is randomly adding print statements instead of using the debugger.

What is the `res/` directory and how do you use resource qualifiers?
This tests your grasp of Android's resource system. Explain that res/ separates assets from code and that qualifiers (e.g., layout-land) let the OS pick the right layout. A red flag is checking orientation manually in code instead of using this system.

Difference between project and module build.gradle files?
This tests your understanding of Gradle's project structure and build configuration scope. The project-level file configures global settings like repositories, while the module-level file configures specifics like dependencies and app ID.

Purpose and Key Elements of AndroidManifest.xml
Tests if you know the manifest is the app's contract with the Android OS. A good answer defines its role and lists key elements like activities, permissions, and the launcher intent. A red flag is calling it just a generic 'config file'.

Implement a type-safe DSL for a UI component in Kotlin
This tests your ability to design clean, hierarchical APIs using Kotlin's idiomatic features. A great answer defines model classes, then uses higher-order functions with lambdas with receiver to create a nested structure, and mentions @DslMarker for scope…

What is a reified type parameter in Kotlin?
Tests your grasp of JVM type erasure and Kotlin's solution. Explain that reified makes a generic type accessible at runtime inside an inline function, avoiding manual Class passing. A red flag is failing to link reified directly to inline functions.

How does coroutine cancellation work internally?
Tests your grasp of cooperative cancellation. A good answer explains that cancel() sets a flag, suspend functions check it and throw CancellationException, and non-suspending loops need manual isActive checks.

Explain backpressure in Kotlin Flows and its management operators
This tests your understanding of Flow's pull-based nature and performance tuning. A great answer defines suspension as the default backpressure, then details how buffer, conflate, and collectLatest optimize it.

Explain Kotlin's declaration-site variance with `in` and `out`
This tests your grasp of type systems and API design. Explain how out (covariance/producer) and in (contravariance/consumer) provide type safety at the declaration site, simplifying usage. A red flag is confusing variance with immutability.