Android Developer interview question

How do you structure Android navigation?

Model navigation as explicit destinations and arguments, keep navigation decisions outside reusable UI, restore state after process death, and handle deep links and back-stack behaviour as tested product flows.

Direct answer

What a strong answer covers

How it works

Navigation is modelled as a graph of destinations with typed arguments, whether through Navigation Compose, the XML navigation component, or a hand-rolled back stack. Screens receive arguments and emit events; the decision to navigate lives in one place, such as a ViewModel event handled by the host, so reusable composables do not depend on the navigation library. Deep links map URLs to destinations with a synthesised back stack, the back stack is saved for process death, and nested graphs group flows such as onboarding or checkout that have their own entry and exit rules.

Example

A checkout flow is a nested graph with cart, address, and payment destinations sharing one ViewModel scoped to the graph; finishing payment pops the whole graph back to the order list. Opening a push notification for an order deep-links to the order detail with the order list beneath it, so the back button behaves the same as if the user had navigated there.

Common mistakes

  • Passing whole objects as arguments instead of IDs and hitting size limits or stale data.
  • Calling the NavController from inside reusable composables and coupling them to the graph.
  • Ignoring process death so a restored app lands on a screen with null arguments.

A useful answer structure

Answer from your own work.

Do not memorise a script: use only examples you can explain honestly in follow-up questions.

Practise this answer with MiraHint

Open the desktop workspace and rehearse a clear answer in your own words.

Download MiraHint
Android Developer interview questions