Android (Kotlin) Interview Questions and Answers

Android and Kotlin interview questions with answers and code: Kotlin language features, coroutines and Flow, Jetpack Compose, lifecycle, ViewModel, architecture, persistence, performance and testing.

Updated November 20, 2026 30 questions 7 min read

Key takeaways

  • Android interviews test Kotlin, coroutines, lifecycle and architecture together.
  • Jetpack Compose questions (state, recomposition, side effects) are now standard.
  • Expect configuration changes and process death questions: where state lives and how it survives.
  • Senior roles add modularization, performance, offline-first data and testing strategy.
Contents

Android interviews test Kotlin, coroutines, Compose, lifecycle and architecture, plus how you keep apps fast and reliable. Below are 30 common questions grouped by topic and level, with code.

What Android interviews cover

Typical topic mix in an Android interview loop

Editorial estimate.

4–5rounds
  • Kotlin and coroutines25%
  • Jetpack Compose and UI20%
  • Lifecycle and architecture20%
  • Data, networking and background work15%
  • Performance and testing10%
  • Coding or take-home10%

Where state should live

StateSurvives recompositionSurvives rotationSurvives process death
remember✓
rememberSaveable✓✓✓
ViewModel field✓✓
SavedStateHandle✓✓✓
Room / DataStore✓✓✓

See also iOS (Swift) and Java interview questions.

Kotlin

1How does Kotlin handle null safety?

Junior

Types are non-null by default; nullable types are marked with ?. You use safe calls (user?.name), the Elvis operator (name ?: "Guest"), smart casts after null checks, and !! only when you’re certain, since it throws on null.

2val vs var, and what does lateinit do?

Junior

val is read-only after assignment; var can be reassigned. lateinit var allows a non-null property to be initialized later (for example by dependency injection); accessing it before initialization throws an exception.

3What are data classes and sealed classes?

Junior

Data classes generate equals, hashCode, toString and copy for value-holding types. Sealed classes and interfaces define a closed set of subtypes, so when expressions can be exhaustive, which is ideal for UI states:

sealed interface UiState {
    data object Loading : UiState
    data class Success(val items: List<Item>) : UiState
    data class Error(val message: String) : UiState
}

4What are scope functions (let, run, apply, also, with)?

Mid

Functions that execute a block on an object. apply and also return the object (configuration, side effects); let, run and with return the block’s result. let is common for null checks: user?.let { show(it) }.

5What are extension functions and inline functions?

Mid

Extension functions add functions to existing types without inheritance (fun String.isEmail(): Boolean). inline functions copy their body and lambda arguments into the call site, avoiding lambda allocations and enabling non-local returns and reified type parameters.

Coroutines and Flow

6What are coroutines, and how do they differ from threads?

Mid

Lightweight, suspendable computations. A suspended coroutine doesn’t block its thread, so thousands can run on a few threads. They make asynchronous code sequential and readable, with structured concurrency for cancellation.

7What is structured concurrency?

Mid

Coroutines are launched in a scope, and the scope doesn’t complete until its children finish. Cancelling the scope cancels all children, and failures propagate to the parent. On Android, viewModelScope and lifecycleScope tie coroutines to component lifetimes, preventing leaks.

8What are dispatchers?

Mid

They decide which threads run a coroutine: Dispatchers.Main for UI, Dispatchers.IO for blocking I/O, Dispatchers.Default for CPU-intensive work. Use withContext(Dispatchers.IO) inside repository functions so callers can stay on Main.

9launch vs async?

Mid

launch starts a coroutine that doesn’t return a result (returns a Job). async returns a Deferred whose result you get with await(), used to run tasks in parallel inside a scope.

10Flow vs StateFlow vs SharedFlow?

Mid

A cold Flow emits values only when collected. StateFlow is a hot flow that always holds a current value, ideal for UI state. SharedFlow is a hot flow for events broadcast to several collectors, with configurable replay.

11How do you collect flows safely in the UI?

Senior

Collect only while the UI is visible: repeatOnLifecycle(Lifecycle.State.STARTED) in views, or collectAsStateWithLifecycle() in Compose. This stops work in the background and avoids wasted resources.

Get Android (Kotlin) answer points in real time during your interview

Sottena listens to the interviewer, detects each question and shows short answer points in about a second. 150 free credits, no card required.

Jetpack Compose

12What is recomposition?

Mid

When state read by a composable changes, Compose re-runs that composable to update the UI. It can skip composables whose inputs haven’t changed. Composables should therefore be fast and free of side effects.

13remember vs rememberSaveable?

Mid

remember keeps a value across recompositions but loses it on configuration changes. rememberSaveable also saves it in the instance state bundle, so it survives rotation and process death (for saveable types).

14What is state hoisting?

Mid

Moving state up to a caller and passing the value and an event callback down, making composables stateless and reusable: SearchBar(query = query, onQueryChange = { query = it }).

15How do side effects work in Compose?

Senior

Use effect APIs instead of running side effects directly in composition: LaunchedEffect(key) runs a coroutine when the key changes, DisposableEffect handles setup and cleanup, rememberCoroutineScope launches work from callbacks, and SideEffect publishes state to non-Compose code.

16How do you improve Compose performance?

Senior

Read state as late as possible (for example in lambdas or Modifier blocks), use stable and immutable types, use key and contentType in lazy lists, avoid heavy work in composition, use derivedStateOf for computed state, and check recomposition counts with the Layout Inspector.

Lifecycle and architecture

17Explain the activity lifecycle.

Junior

onCreate → onStart (visible) → onResume (interactive) → onPause → onStop (not visible) → onDestroy. Configuration changes such as rotation destroy and recreate the activity by default, so state must be stored elsewhere.

18Why use a ViewModel?

Mid

It survives configuration changes, holds UI state and business logic outside the UI, and exposes state through StateFlow. Its viewModelScope cancels work when the ViewModel is cleared. It does not survive process death; use SavedStateHandle for small essential state.

19How do you handle process death?

Mid

The system can kill your app in the background and restore it later with saved state. Persist essential UI state in SavedStateHandle or rememberSaveable, reload data from repositories, and test it with “Don’t keep activities” or by killing the process from the developer tools.

20What is MVVM vs MVI in Android?

Mid

In MVVM, the ViewModel exposes observable state and the view binds to it. MVI adds unidirectional data flow: the UI sends intents, a reducer produces a single immutable state, and the UI renders it. Many modern apps use an MVVM structure with a single UI state object, which is close to MVI.

21What does dependency injection with Hilt give you?

Mid

Generated, compile-time-checked DI integrated with Android components and lifetimes (@Singleton, @ViewModelScoped), injection into ViewModels with @HiltViewModel, and easy replacement of dependencies in tests.

22How would you modularize a large Android app?

Senior

Split by feature modules with shared core modules (design system, networking, data), keep dependencies one-directional, expose features through APIs, and use convention plugins for Gradle configuration. Benefits: faster builds, clearer ownership and better encapsulation.

Data and networking

23What is Room, and why use it?

Mid

An abstraction over SQLite with compile-time checked queries, entities and DAOs, migrations and Flow support for observing changes. It’s the standard choice for local structured data.

24How do you build an offline-first feature?

Senior

Make the local database the single source of truth: the UI observes it, the repository syncs with the network and writes results to the database. Queue local changes and sync them with WorkManager, handle conflicts, and show sync status in the UI.

25When do you use WorkManager?

Mid

For deferrable, guaranteed background work that must run even if the app is closed or the device restarts: uploads, sync, periodic cleanup. It respects constraints like network and battery and works within the system’s background limits.

Performance and testing

26How do you find and fix memory leaks on Android?

Mid

Use LeakCanary in debug builds and the Android Studio memory profiler. Common causes: long-lived objects holding an Activity or View (static fields, singletons, listeners not removed), and coroutines or callbacks outliving their screen.

27How do you improve app startup time?

Mid

Measure with Macrobenchmark, defer non-essential initialization (lazy init, App Startup), avoid heavy work on the main thread, reduce the first screen’s complexity, and add Baseline Profiles so critical code is precompiled.

28How do you test an Android app?

Mid

Unit tests for ViewModels and use cases with fake repositories and kotlinx-coroutines-test, Compose UI tests with semantics matchers, integration tests for Room with an in-memory database, and a few end-to-end tests for critical flows.

29Write a ViewModel that loads items and exposes UI state.

Mid
@HiltViewModel
class ItemsViewModel @Inject constructor(
    private val repo: ItemsRepository
) : ViewModel() {
    private val _state = MutableStateFlow<UiState>(UiState.Loading)
    val state: StateFlow<UiState> = _state.asStateFlow()

    init { load() }

    fun load() = viewModelScope.launch {
        _state.value = UiState.Loading
        _state.value = runCatching { repo.items() }
            .fold({ UiState.Success(it) }, { UiState.Error(it.message ?: "Error") })
    }
}

Note that runCatching also catches CancellationException; in production code, rethrow it.

30How do you secure sensitive data in an Android app?

Senior

Keep secrets on the server, store tokens with the Android Keystore (encrypted storage), use HTTPS with certificate pinning where justified, avoid logging sensitive data, set android:allowBackup appropriately, and obfuscate with R8.

How to prepare

  1. Master coroutines and FlowScopes, dispatchers, cancellation, StateFlow and lifecycle-aware collection.
  2. Practice Compose fundamentalsState, recomposition, hoisting and side-effect APIs.
  3. Explain state survivalConfiguration changes vs process death, and where each piece of state lives.
  4. Build a small sample appList + detail screen with Room, Retrofit, Hilt and tests.
  5. Prepare a performance storyA leak, jank or startup problem you fixed, with measurements.

Get answer points in real time during your interview

Sottena listens to the interviewer, detects each question and shows short answer points in about a second. 150 free credits, no card required.

Related interview questions