Skip to content
tezvyn:

Android

433 bites tagged Android — interview questions with model answers, and 60-second explainers.

Android & Kotlin2 min read

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`.

Android & Kotlin2 min read

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.

Android & Kotlin2 min read

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.

Android & Kotlin2 min read

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.

Android & Kotlin2 min read

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'.

Android & Kotlin2 min read

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…

Android & Kotlin2 min read

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.

Android & Kotlin3 min read

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.

Android & Kotlin2 min read

What is a CoroutineDispatcher and when do you use each type?

Tests your grasp of coroutine threading. A dispatcher manages which threads a coroutine runs on. Explain `Main` for UI, `Default` for CPU-intensive work, and `IO` for blocking operations. A red flag is mixing up `IO` and `Default` or using `Unconfined`.

Android & Kotlin2 min read

Hot vs. Cold Streams: `StateFlow` vs. `Flow`

Tests your grasp of stream lifecycles. A great answer defines cold `Flow` (lazy, per-collector) vs. hot `StateFlow` (shared, active), then uses a ViewModel UI state scenario to show why `StateFlow` is correct for surviving configuration changes.

Android & Kotlin2 min read

Structured Concurrency in Kotlin Coroutines

Tests your understanding of coroutine lifecycles and error handling. A good answer defines the parent-child relationship, then explains how cancellation and exceptions propagate through the scope. A red flag is simply calling it a way to 'group' coroutines.

Android & Kotlin2 min read

Explain Kotlin's scope functions: let, run, with, apply, also

This tests your grasp of idiomatic Kotlin and the two key differentiators: context object (`this`/`it`) and return value (object/lambda result). A great answer defines these axes, categorizes each function, and provides a clear example.

Android & Kotlin2 min read

What is a `suspend` function in Kotlin?

Tests your grasp of Kotlin's core concurrency primitive. A `suspend` function can pause and resume. It must be called from another suspend function or a coroutine builder.

Android & Kotlin2 min read

Difference between launch and async in Kotlin Coroutines

This tests your grasp of coroutine result handling and exception propagation. Explain that `launch` is fire-and-forget (returns `Job`), while `async` is for results (returns `Deferred`). Mention `async` defers exceptions until `await()`.

Android & Kotlin2 min read

Compare and contrast Kotlin's `apply` and `let` scope functions

This tests your grasp of idiomatic Kotlin scope functions. `apply` uses `this` and returns the object, ideal for configuration. `let` uses `it` and returns the lambda result, useful for null-safe chaining.

Android & Kotlin2 min read

When would you use a sealed class instead of an enum?

This tests your understanding of state representation. Explain that sealed classes define a hierarchy of types that can hold different data, while enums are a set of singleton constants.

Android & Kotlin2 min read

Explain and implement a higher-order function in Kotlin

Tests your grasp of functions as first-class citizens. Define a higher-order function, explain it takes/returns functions, then implement `filterAndTransform` using the specified lambdas.

Android & Kotlin2 min read

lateinit var vs. val by lazy in Android

Tests your grasp of Kotlin's non-nullable property initialization. Define `lateinit` (mutable, framework-init) vs. `lazy` (immutable, deferred-init). Use `lateinit` for Views in `onCreate` and `lazy` for expensive objects. Red flag: confusing their mutability.

Android & Kotlin2 min read

What are the advantages of a Kotlin data class?

Tests knowledge of Kotlin's boilerplate reduction for data holders. A good answer defines the advantage (conciseness), names generated functions like `equals`, `hashCode`, and `copy`, and explains `copy` for immutable state updates.

Android & Kotlin2 min read

What is a Kotlin extension function? Write one for String.

Tests your grasp of adding functionality to existing classes without inheritance. A great answer defines it as syntactic sugar over static methods, explains its use for third-party code, then implements the requested `String.hasWhitespace` function.

Android & Kotlin2 min read

Purpose of Kotlin's safe call (`?.`) and Elvis (`?:`) operators?

This tests your grasp of Kotlin's null safety philosophy. A good answer defines the safe call (`?.`) for conditional access and the Elvis operator (`?:`) for default values, then combines them. A red flag is using verbose `if/else` checks for simple cases.

Android & Kotlin2 min read

Explain val vs. var and null safety in Kotlin

Tests your grasp of Kotlin's core principles: immutability and compile-time null safety. Define `val` (read-only) vs. `var` (mutable), declare nullables with `?`, and identify the risk as runtime `NullPointerException`s.

Android & Kotlin2 min read

Coroutine Exception Handling: launch vs. async

Coroutine builders handle exceptions differently. `launch` propagates them immediately, crashing if unhandled. `async` silently catches them, waiting for you to call `await`. Use a `CoroutineExceptionHandler` on root scopes for global logging.

Android & Kotlin2 min read

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

This tests your grasp of state vs. events. A `LiveData<Boolean>` is state; it re-triggers on rotation. Instead, expose events via a `StateFlow` and have the UI call an `eventConsumed()` function on the ViewModel to maintain unidirectional data flow.

Get Android bites daily.

Five a day, five minutes, offline. With quizzes so it sticks.

Open testing — you’ll join as an early tester.