Skip to content

Expert: features and shipping · Android career path · topic 49 of 50 · 35 min

Interview questions: Android and Compose

Explanation

Android interviews cover the activity lifecycle and configuration changes, ViewModel and state, Compose recomposition, remember versus rememberSaveable, state hoisting, lazy lists and keys, navigation, Room, Retrofit and offline handling, permissions, testing and publishing (AAB, signing). Many companies also give a take-home assignment.

Q1. Explain the activity lifecycle.

Model answer: "onCreate sets up the UI, onStart makes it visible, onResume makes it interactive; leaving goes through onPause, onStop and possibly onDestroy. On a configuration change like rotation, the activity is destroyed and recreated by default, so I keep state in a ViewModel and small UI state in rememberSaveable. onDestroy is not guaranteed if the process is killed, so I save important data earlier."

Q2. Why use a ViewModel?

Model answer: "It holds screen state and logic, survives configuration changes, and provides viewModelScope so work is cancelled when the screen is gone. It exposes a read-only StateFlow of a UiState data class; the UI sends events as function calls. It must never hold an Activity or View reference."

Q3. What is recomposition?

Model answer: "When state read by a composable changes, Compose re-runs that composable to update the UI, skipping parts whose inputs did not change. Composables should be fast and side-effect free because they can run often. Side effects go in effect handlers like LaunchedEffect, or in the ViewModel."

Q4. remember versus rememberSaveable? What is state hoisting?

Model answer: "remember keeps a value across recompositions; rememberSaveable also survives configuration changes and process death for saveable types. State hoisting moves state up to the caller: the composable receives the value and an onValueChange lambda, which makes it stateless, reusable and testable."

Q5. Why keys in LazyColumn?

Model answer: "Lazy lists compose only visible items. Stable unique keys let Compose keep each item's state and scroll position correct when items are inserted, removed or reordered, and enable item animations."

Q6. How would you build an offline-capable list?

Model answer: "A repository with Room as the single source of truth exposes a Flow to the ViewModel; a refresh function fetches from Retrofit and upserts into Room; failures keep showing cached data with an offline message. WorkManager can sync in the background."

Q7. How do runtime permissions work?

Model answer: "Dangerous permissions are declared in the manifest and requested at the moment of use with the Activity Result API; I check first, explain if denied, and offer a fallback or link to settings. On Android 13+ notifications need POST_NOTIFICATIONS."

Q8. What is an AAB, and what is Play App Signing?

Model answer: "An Android App Bundle is the publishing format from which Play generates optimised APKs per device. I sign uploads with my upload key; with Play App Signing, Google holds the app signing key. versionCode must increase with every upload."

Take-home assignments

Many companies ask you to build a small app in 2 to 4 days, for example "a list from this API with a details screen". Reviewers look for:

  • Clean architecture: UI, ViewModel, repository; dependency injection.
  • Loading, error and empty states handled.
  • Configuration changes handled (rotate the phone!).
  • Some unit tests for ViewModel or repository logic.
  • A clear README: how to run, decisions made, what you would improve with more time.
  • Readable, consistent code; no leftover debug code or commented-out blocks.

Common interview mistakes

  • Not rotating the phone in a take-home app: state lost on rotation is the most common failure.
  • Over-engineering a 2-day assignment with five modules. Clean and simple wins.
  • Saying "I would use the latest library" without explaining why.
  • Not asking clarifying questions about requirements.

Need help?

Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.

Try:

Watch the lesson

Interview questions: Android and Compose · 1/6

Lifecycle | State | Data | Release

Expect lifecycle, ViewModel, Compose state, lists, data, permissions and publishing questions.

Prefer a video by a teacher? Find free videos on “android interview questions compose viewmodel lifecycle take home assignment” on YouTube ↗

In real life: A system design follow-up for a senior role

An interviewer asks: "Design the order tracking screen of a food delivery app." A strong answer covers the UiState (status, rider location, ETA), a repository combining a WebSocket or polling stream with Room for offline display, a ViewModel exposing StateFlow, lifecycle-aware collection so tracking pauses in the background, push notifications through FCM for status changes, and error handling for weak networks.

kotlin
data class TrackingUiState(
    val status: String = "Placed",
    val riderName: String? = null,
    val etaMinutes: Int? = null,
    val isOffline: Boolean = false,
)
Start a design answer by naming the state the screen must show.

Practice (0/3 done)

Task 1 · Question

Your take-home app loses the typed search text when the phone is rotated. What is the best fix?

Task 2 · Question

Where should a side effect like starting a network call when a screen first appears go in Compose?

Task 3 · Practice

Do a mock take-home in one weekend: an app that lists items from a public API, shows a details screen, handles loading, error and empty states, survives rotation, caches data with Room, and has at least 3 ViewModel unit tests. Write a README with decisions and improvements.

Quick quiz

Question 1

1.What survives process death for small UI values?

Question 2

2.Why must a ViewModel not hold an Activity reference?

Question 3

3.What is the single source of truth in a typical offline-first list?

Question 4

4.What do reviewers most often check first in a take-home Android app?

Read more (free)

Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.

What survives process death for small UI values?

Answer: rememberSaveable

Saved instance state is restored.

Why must a ViewModel not hold an Activity reference?

Answer: The ViewModel outlives the activity, causing a memory leak

The activity is recreated on rotation.

What is the single source of truth in a typical offline-first list?

Answer: The Room database

The UI observes local data.

What do reviewers most often check first in a take-home Android app?

Answer: Whether it runs, handles states and rotation, and has clean structure

Working basics and clean structure matter most.

What is recomposition?Related

Answer: Compose re-running composables that read changed state

Only affected composables re-run.

From State and recomposition

Is onDestroy guaranteed to run before Android kills a background process?Related

Answer: No; save important data earlier

The process may be killed without onDestroy.

From Activities and the lifecycle

What matters most in a take-home assignment?Related

Answer: A working, clean, tested app with handled states and a clear README

Quality over quantity.

From Interview questions: Flutter

What does the ViewModel expose to the UI?Related

Answer: A read-only StateFlow of UI state

Expose read-only state.

From ViewModel and MVVM

Pass the quiz (60% or more) or mark this topic as done when you are ready.

Your progress is saved on this device only.

Next steps

  1. 1 more topic in “Android career path” before its exam: Portfolio and next steps.
  2. Module 12 exam: Android career path · 10 questions · 20 min, without help. 4 topics of this module still to finish first.
  3. 50 topics left in the course before the final exam.

← Previous: Interview questions: Kotlin