Android Developer interview questions
100 real questions with model answers and explanations for Junior candidates.
See a Android Developer resume example →Practice with flashcards
Spaced repetition · Hunter Pass
Questions
The four main Android application components are Activity, Service, BroadcastReceiver, and ContentProvider.
- An Activity presents an interactive screen to the user.
- A Service represents work without a user interface, subject to Android background-execution rules.
- A BroadcastReceiver reacts to broadcast messages, while a ContentProvider exposes structured data through a standard interface.
Why interviewers ask this: The interviewer checks whether you know the platform building blocks and the responsibility of each one.
An Activity is an Android component that provides a window for a focused user interaction.
- It usually owns one screen or one major entry point in an application.
- The system creates, pauses, stops, and may destroy it as the user navigates or device conditions change.
- Its declaration in the manifest lets Android discover and launch it.
Why interviewers ask this: A strong answer treats Activity as a system-managed component rather than merely a Kotlin class for a screen.
A newly opened Activity normally receives onCreate, onStart, and onResume, then onPause, onStop, and onDestroy when it closes.
- onCreate performs initial setup for that Activity instance.
- onStart makes it visible, and onResume makes it ready for foreground interaction.
- onPause and onStop remove it from active use before onDestroy performs final instance cleanup.
Why interviewers ask this: The interviewer is evaluating whether you understand the basic lifecycle order and the state represented by each transition.
onCreate should establish the Activity's initial UI and instance-level setup.
- It calls super.onCreate so the framework can restore and initialize its own state.
- A View-based screen inflates or sets its layout there, while a Compose screen commonly calls setContent.
- It is also a suitable place to connect state holders and read initial Intent data without assuming the callback runs only once during the app process.
Why interviewers ask this: A good answer identifies initial setup while recognizing that an Activity instance can be recreated.
onStart means the Activity is visible, while onResume means it is in the foreground and ready for user interaction.
- An Activity can be started but not resumed when another window partly covers it.
- UI-related observers can become active according to the lifecycle state they require.
- onResume should not be treated as a one-time initialization callback because it may run many times.
Why interviewers ask this: The interviewer checks whether you distinguish visibility from active foreground interaction.
onPause signals loss of foreground focus, while onStop means the Activity is no longer visible.
- onPause should complete quickly because the next Activity may be waiting to resume.
- onStop is appropriate for work that is only needed while the screen remains visible.
- Neither callback guarantees that onDestroy will follow, because the process can be terminated after the Activity stops.
Why interviewers ask this: A strong answer connects each callback to visibility and avoids relying on onDestroy for essential persistence.
Android can recreate an Activity so resources and layout can be selected for the new device configuration.
- Rotation, locale, screen size, and theme-related changes can produce a different configuration.
- The old Activity instance is destroyed and a new one is created by default.
- Durable screen data should live outside transient View objects, commonly in a ViewModel, while small restorable UI state can use saved-state mechanisms.
Why interviewers ask this: The interviewer checks whether you understand recreation as normal platform behavior and know where screen state belongs.
savedInstanceState stores a small serializable snapshot that helps restore transient UI state after Activity or Fragment recreation.
- The framework passes the saved Bundle to a newly created component when state is available.
- Values should be small because the state is transferred through a size-limited system mechanism.
- It complements rather than replaces persistent storage or a ViewModel holding richer screen data.
Why interviewers ask this: A good answer states the restoration purpose and the limits of using a Bundle as general data storage.
A Fragment is a reusable, lifecycle-aware portion of UI hosted by an Activity.
- It has its own lifecycle while depending on a host and FragmentManager.
- Multiple fragments can compose one Activity or represent destinations within it.
- A Fragment may create and destroy its View several times while the Fragment object itself remains alive.
Why interviewers ask this: The interviewer is checking whether you understand both Fragment reuse and its dependence on a host Activity.
A Fragment has a separate View lifecycle because its UI can be destroyed before the Fragment instance is removed.
- onCreate and onDestroy describe the Fragment object's lifetime.
- onCreateView through onDestroyView describe the lifetime of its current View hierarchy.
- View binding and UI observers should be cleared or scoped to the View lifecycle to avoid holding a destroyed View.
Why interviewers ask this: A strong answer explains the two lifetimes and their consequence for references to views.
FragmentManager coordinates fragments, while a FragmentTransaction groups operations that change them.
- A transaction can add, replace, remove, show, or hide fragments in a container.
- commit schedules the grouped changes to be applied by FragmentManager.
- Adding a transaction to the back stack lets the Back action reverse it instead of immediately discarding navigation history.
Why interviewers ask this: The interviewer checks whether you know how fragments are hosted, changed, and optionally placed on navigation history.
An explicit Intent names the component to launch, while an implicit Intent describes an action that a matching component may handle.
- Explicit Intents are common for navigation to a known Activity within the same app.
- Implicit Intents can request capabilities such as opening a web page or sharing text.
- Android resolves an implicit Intent against registered intent filters, and there may be zero, one, or several matching apps.
Why interviewers ask this: A good answer distinguishes direct component selection from capability-based system resolution.
An Intent can carry an action, optional data, categories, extras, flags, and an explicit component.
- The action describes the requested operation, such as viewing or sending data.
- The data URI and MIME type describe the target content.
- Extras hold small typed values in a Bundle, while flags influence launch or task behavior.
Why interviewers ask this: The interviewer is evaluating whether you understand an Intent as a structured message rather than only a navigation call.
An intent filter declares which implicit Intents an Android component is prepared to receive.
- It can match an Intent's action, categories, and data characteristics.
- Filters are commonly declared in the manifest for Activities, Services, and BroadcastReceivers where supported.
- A filter exposes capability to other callers but does not itself validate whether received data is trustworthy.
Why interviewers ask this: A strong answer covers matching and recognizes that discoverability does not replace input validation.
A task is a user-facing sequence of Activities arranged in a back stack.
- Starting an Activity normally places a new Activity record on top of the current task.
- Pressing Back removes the top destination and reveals the previous one.
- Launch modes and Intent flags can alter this default behavior, so they should be used with a clear understanding of task semantics.
Why interviewers ask this: The interviewer checks whether you can explain Android navigation history beyond individual Activity calls.
Jetpack Navigation provides a structured way to define destinations and move between them while maintaining navigation state.
- A navigation graph declares destinations, actions, and arguments.
- NavController performs navigation and manages the destination back stack.
- Integrations support Fragments, Compose, deep links, and common UI elements such as an app bar.
Why interviewers ask this: A good answer identifies the graph, controller, and back-stack responsibilities rather than calling Navigation only a routing library.
A deep link is a URI or request that opens a specific destination inside an application.
- It can enter the app from a browser, notification, another app, or an Android App Link.
- The destination must declare or register a matching URI pattern and receive any defined arguments.
- Navigation should construct a sensible back stack so Back behaves predictably after external entry.
Why interviewers ask this: The interviewer is checking whether you understand both destination matching and navigation history for external entry points.
A View is a basic UI element, while a ViewGroup is a View that contains and arranges child Views.
- TextView, ImageView, and Button are individual View types.
- LinearLayout, FrameLayout, and ConstraintLayout are ViewGroup types.
- A ViewGroup participates in measuring and laying out its children according to its own LayoutParams rules.
Why interviewers ask this: The interviewer checks whether you understand the hierarchy underlying XML-based Android interfaces.
The View system measures required sizes, assigns positions, and then draws the hierarchy.
- During measure, parent constraints help each View determine its measured width and height.
- During layout, a parent assigns bounds to each child.
- During draw, Views render backgrounds, content, and child Views to the drawing surface.
Why interviewers ask this: A strong answer demonstrates a basic mental model of how a View hierarchy becomes pixels on screen.
These ViewGroups use different layout rules for their children.
- LinearLayout places children in one horizontal or vertical sequence.
- FrameLayout stacks children in the same area and is often used as a simple container.
- ConstraintLayout positions Views through relationships to the parent and other Views, allowing complex flat layouts.
Why interviewers ask this: The interviewer is evaluating whether you can choose among common XML layout containers based on their basic model.
Locked questions
- 21
What are dp, sp, and px in Android UI?
- 22
What does it mean to inflate an XML layout?
ui - 23
What is View Binding?
ui - 24
What problem does RecyclerView solve?
ui - 25
What does a RecyclerView.Adapter do?
ui - 26
What is the ViewHolder pattern in RecyclerView?
ui - 27
What is the role of RecyclerView.LayoutManager?
ui - 28
What is an Android Service?
android-components - 29
How do started and bound Services differ?
android-components - 30
What is a foreground Service?
android-components - 31
What is a BroadcastReceiver?
android-components - 32
How do ContentProvider and ContentResolver work together?
- 33
What information belongs in AndroidManifest.xml?
- 34
Why does Android keep strings, dimensions, colors, and images in resources?
- 35
How do resource qualifiers work in Android?
- 36
What is the generated R class?
- 37
How do normal and dangerous Android permissions differ?
permissions - 38
What is the basic flow for using a dangerous permission?
permissions - 39
What is Context in Android?
android-components - 40
How do Activity Context and Application Context differ?
android-components - 41
What does Room provide in an Android application?
room - 42
What problem does Hilt solve in Android development?
dependency-injection - 43
What is the difference between val and var in Kotlin?
kotlin - 44
How does Kotlin represent nullable and non-null types?
fundamentalskotlin - 45
What do Kotlin's safe-call, Elvis, and non-null assertion operators do?
fundamentalskotlin - 46
What does a Kotlin data class provide?
kotlin - 47
What is a composable function in Jetpack Compose?
composejetpack - 48
What do suspend functions and coroutines mean in Kotlin?
coroutineskotlin - 49
Why are coroutine scopes such as lifecycleScope and viewModelScope used on Android?
lifecyclearchitecture-componentscoroutines - 50
How does Jetpack Compose UI differ from XML layouts with Views?
composeuijetpack - 51
How would you build and edit a profile screen?
- 52
How would you implement a Compose registration form?
formscompose - 53
How would you fix Flow collection after a Fragment view is destroyed?
uiandroid-components - 54
How would you use View Binding safely in a Fragment?
uiandroid-components - 55
How would you prevent reload on every onStart?
- 56
How would you fix a dialog reopening after rotation?
- 57
How would you add pull-to-refresh without hiding content?
- 58
How would you observe LiveData safely in a Fragment?
android-componentsarchitecture-components - 59
How would you start one Compose load without recomposition repeats?
compose - 60
How would you support phone and tablet layouts?
ui - 61
How would you display an API list in RecyclerView?
uiapi - 62
How would you stop RecyclerView refreshing every row?
ui - 63
How would you handle row clicks outside the adapter?
ui - 64
How would you add basic list pagination?
pagination - 65
How would you model loading, empty, error, and content states?
- 66
How would you preserve RecyclerView scroll after rotation?
ui - 67
How would you show headers and rows in one RecyclerView?
ui - 68
How would you fix checkboxes moving between recycled rows?
- 69
How would you delete a row after a server call?
- 70
How would you keep filters after rotation?
- 71
How would you call a REST endpoint with Retrofit?
restendpointsnetworking - 72
How would you load Retrofit data from a ViewModel?
architecture-componentsnetworking - 73
How would you handle 400, 401, 404, and 500 responses?
- 74
How would you debug failed JSON parsing?
- 75
How would you handle leaving during a request?
- 76
How would you add an auth token with OkHttp?
tokensnetworking - 77
How would you distinguish offline, timeout, and server errors?
resilience - 78
How would you stop duplicate POST requests?
- 79
How would you implement debounced API search?
debounceapi - 80
How would you upload a file with retry?
resilience - 81
How would you navigate from list to details?
- 82
How would you prevent Back returning to login?
- 83
How would you pass a destination ID safely?
- 84
How would you open details from a deep link?
navigation - 85
How would you pick and display an image?
- 86
How would you preserve bottom-navigation tab state?
- 87
How would you prevent duplicate navigation?
- 88
How would you find a launch crash from stack trace?
debugging - 89
How would you investigate a Kotlin NullPointerException?
kotlin - 90
How would you investigate an ANR on screen opening?
anr - 91
How would you fix NetworkOnMainThreadException?
- 92
How would you fix a Fragment view leak?
uiandroid-components - 93
How would you request camera permission and handle denial?
permissions - 94
How would you debug SecurityException for a file URI?
- 95
How would you fix IndexOutOfBoundsException in a changing list?
indexes - 96
How would you investigate a device-specific crash?
- 97
How would you restore a draft after process death?
concurrency - 98
How would you schedule sync when network is available?
- 99
How would you create an offline note that syncs later?
- 100
How would you fix reload, lost edits, and duplicate navigation after rotation?