Android interviews should reveal how candidates build applications that remain responsive and correct across lifecycle changes, unreliable networks, and diverse devices. Recruiters need to assess state ownership, concurrency, persistence, security, accessibility, and diagnosis. A screen that works on first launch is only the beginning; a capable developer can explain what happens when the process disappears or a request completes after the user leaves.
This guide to 100+ Android Interview Questions and Answers contains 120 questions across beginner, intermediate, and experienced levels. It covers platform components, Kotlin coroutines, Compose, local data, background work, permissions, testing, and architecture. Scenarios connect API choices to user-visible behavior and practical recovery from failure.
How can recruiters verify genuine Android engineering experience when a candidate knows lifecycle terminology but cannot explain a screen that loses state after process death?
Ask the candidate to trace one user action through UI state, a ViewModel, local storage, and a network request. Then introduce recreation, permission denial, or a delayed response. Look for explicit ownership, a coherent recovery path, and tests that distinguish simulated behavior from real framework integration.
Sherlock AI helps hiring teams assess signals of potential AI cheating, deepfakes, impersonation, and unauthorized assistance during interviews.
Consider these signals alongside practical exercises and the candidateโs explanation, without treating a signal as conclusive proof of misconduct. Strong interviews reward a candidateโs ability to adapt reasoning to device constraints, user expectations, and the actual supported platform versions.
Android Interview Questions
Use this complete question bank to select an interview sequence before consulting the matching answers. Numbering runs continuously across all three difficulty levels.
Android Interview Questions for Beginners
Establish platform components, lifecycle, state, coroutines, persistence, permissions, and testing foundations. Look for clear explanations of which objects survive each kind of recreation.
What are the main Android application components?
What is an Activity?
What is a Fragment?
What is a Service?
What is a BroadcastReceiver?
What is a ContentProvider?
What does AndroidManifest.xml describe?
How do explicit and implicit intents differ?
What is an intent filter?
What is Context used for?
What are the key Activity lifecycle callbacks?
How does a configuration change affect an Activity?
How does process death differ from a configuration change?
What is a ViewModel?
What is SavedStateHandle for?
What is the main thread responsible for?
What is an ANR?
How do dp and sp differ?
What are Android resources and qualifiers?
How do minSdk, targetSdk, and compileSdk differ?
What is Jetpack Compose?
What is recomposition?
What does remember do?
What does rememberSaveable do?
What is state hoisting in Compose?
What is unidirectional data flow?
What is a repository in Android architecture?
What is a Kotlin coroutine?
What is a suspend function?
How do launch and async differ?
What is Flow?
What is StateFlow?
How do StateFlow and LiveData differ?
What is Room?
What is DataStore used for?
What is WorkManager?
What is a foreground service?
How should runtime permissions be requested?
How do internal storage and shared storage differ?
What kinds of Android tests are commonly used?
Android Interview Questions for Intermediate
Examine practical state collection, effects, cancellation, queries, synchronization, background work, and security boundaries. Ask candidates to identify prerequisites and test failure paths.
How should a Fragment observe screen state safely?
How should Compose collect a Flow from a ViewModel?
When should LaunchedEffect be used?
When should DisposableEffect be used?
What problem does rememberUpdatedState solve?
When is derivedStateOf useful?
Why do stable keys matter in lazy lists?
How would you investigate excessive Compose recomposition?
How should navigation arguments be designed?
How should a screen restore after process death?
How should coroutine dispatchers be selected?
What is structured concurrency?
How should cancellation be handled in coroutine code?
How do coroutineScope and supervisorScope differ?
How should network errors be represented in UI state?
How can search-as-you-type avoid stale results?
How do cold and shared flows affect network calls?
How should one-time UI actions be modeled?
How would you design a Room DAO?
When should Room operations use a transaction?
How should Room schema migrations be tested?
How would you design an offline-first data flow?
How should a Worker report success, failure, and retry?
What is unique work in WorkManager?
How should WorkManager constraints be used?
When should AlarmManager be considered instead of WorkManager?
What must a foreground-service design account for?
How should notification permission denial be handled?
How should exported components be secured?
How should deep-link input be validated?
What are Android App Links?
Why does PendingIntent mutability matter?
How should files be shared with another app?
How would you handle URI-based content safely?
How should application secrets be protected?
How should HTTPS failures be handled?
What causes memory leaks in Android apps?
How would you diagnose jank?
What is a Baseline Profile?
How should dependency injection scopes be chosen?
Android Interview Questions for Experienced
Use architecture and incident scenarios to evaluate trade-offs, recovery, security boundaries, and operational ownership. Strong answers state assumptions and explain how to test them.
How would you design a scalable Android application architecture?
How would you choose module boundaries in a large app?
How would you migrate a View-based UI to Compose?
How would you investigate a production ANR?
How would you investigate a crash that occurs only after restoration?
How would you design synchronization with an unreliable backend?
How would you resolve conflicts in an offline editing app?
How would you prevent duplicate purchases or submissions?
How would you design secure authentication state handling?
How would you coordinate concurrent token refresh requests?
How would you design account switching safely?
How would you protect sensitive data in logs and analytics?
How would you review a third-party Android SDK?
How would you diagnose excessive battery usage?
How would you design location tracking responsibly?
How would you manage large media uploads?
How would you design a download feature that survives interruption?
How would you handle schema changes across staged app releases?
How would you test lifecycle-sensitive behavior?
How would you test coroutine-based state holders?
How would you test WorkManager behavior?
How would you reduce flaky UI tests?
How would you design accessibility acceptance criteria?
How would you support tablets and resizable windows?
How would you investigate slow startup?
How would you manage image-loading performance?
How would you diagnose an out-of-memory crash?
How would you secure a WebView feature?
How would you validate an app-link rollout?
How would you respond to a client-side security vulnerability?
How would you plan a target-SDK upgrade?
How would you maintain compatibility across Android versions?
How would you design feature-flagged mobile rollouts?
How would you make production behavior observable?
How would you design resilience to poor connectivity?
How would you decide between polling, push, and streaming updates?
How would you handle concurrent local database updates?
How would you design backup and restore behavior?
How would you evaluate build and release reliability?
How would you evaluate a senior Android engineer's architectural judgment?
Android Interview Questions and Answers
The answers match the wording and order of the question bank. Platform behavior can depend on OS version, target SDK, and AndroidX or Kotlin library versions. Code examples state their surrounding dependencies and are contextual snippets, not complete applications. Static review does not establish compilation, emulator behavior, or device integration.
Android Interview Questions and Answers for Beginners
Establish platform components, lifecycle, state, coroutines, persistence, permissions, and testing foundations. Look for clear explanations of which objects survive each kind of recreation.
1. What are the main Android application components?
The main component types are activities, services, broadcast receivers, and content providers. They expose different entry points for user interaction, background responsibilities, events, and structured data access. The system can create components independently, so an app should not rely on one fixed startup sequence. Keep durable state and shared logic outside assumptions about a particular activity instance.
2. What is an Activity?
An Activity provides an entry point for a user-facing interaction and participates in a system-managed lifecycle. Modern apps may use one activity hosting multiple destinations rather than one activity per screen. It should coordinate presentation and platform interactions without becoming the owner of every business rule. Its instance can be recreated, so persistent data cannot depend on that instance surviving.
3. What is a Fragment?
A Fragment is a reusable portion of UI and behavior hosted by an activity or another supported host. It has its own lifecycle, and its view has a separate lifecycle that can end while the fragment instance remains. This distinction matters for observers and view references. Clear view bindings when the view is destroyed to avoid retaining obsolete UI objects.
4. What is a Service?
A Service is an application component for work or capabilities without a direct UI, subject to modern background-execution rules. It does not automatically run on a worker thread. A foreground service also has visibility and permission obligations. Choose the actual work mechanism according to duration, user visibility, and persistence needs rather than assuming every background task belongs in a service.
5. What is a BroadcastReceiver?
A BroadcastReceiver responds to delivered broadcast intents, such as selected system or application events. Its callback should complete promptly rather than performing arbitrary long-running work. Export and permission settings determine which callers can reach it. Treat incoming data as untrusted and delegate durable processing to an appropriate mechanism when the event requires more than brief handling.
6. What is a ContentProvider?
A ContentProvider exposes structured data through a URI-based interface and can support controlled sharing across application boundaries. It is not required merely because an app has a local database. Define permissions and URI access carefully, validate inputs, and avoid exposing more data than intended. A provider API is a security boundary as well as a data-access abstraction.
7. What does AndroidManifest.xml describe?
The manifest declares important application metadata, components, permissions, and platform requirements. Build tools can merge manifests from modules and libraries, so the final merged result matters. Inspect that result when an unexpected component or permission appears. A declaration alone does not mean runtime permission has been granted or a component is safe to expose externally.
8. How do explicit and implicit intents differ?
An explicit intent names a target component, while an implicit intent describes an action and matching criteria for the system to resolve. Use explicit routing for internal operations when appropriate. With external resolution, handle unavailable recipients and avoid sending sensitive extras indiscriminately. Intent filters influence routing but do not replace authorization checks inside an exposed component.
9. What is an intent filter?
An intent filter describes the actions, categories, and data patterns a component can handle for matching intents. It helps routing and discovery rather than proving that a caller is trusted. Validate the actual intent data and enforce relevant permissions. Broad filters can make a component reachable through more inputs than the developer intended, especially for links and shared content.
10. What is Context used for?
Context provides access to application resources, services, and environment-specific operations. Different context instances have different lifetimes and UI capabilities. Use an activity context when an operation requires that UI scope, and avoid retaining it in longer-lived objects. An application context can be appropriate for process-level dependencies, but it is not a universal substitute for every themed UI operation.
11. What are the key Activity lifecycle callbacks?
The familiar callbacks include onCreate, onStart, onResume, onPause, onStop, and onDestroy, representing creation, visibility, interaction, and teardown transitions. Attach work to the lifecycle stage it actually needs. Do not treat onDestroy as a guaranteed final cleanup callback before process termination. Durable data and important operations need mechanisms that survive the absence of that callback.
12. How does a configuration change affect an Activity?
A configuration change can cause the system to recreate the activity so resources and presentation adapt to the new environment. Rotation is one example, but language, window size, and other changes also matter. Keep screen state in appropriate state holders and restore small UI inputs when needed. Avoid disabling recreation broadly merely to hide incorrect state ownership.
13. How does process death differ from a configuration change?
Process death removes the app's in-memory objects, including ViewModels, while configuration recreation may preserve appropriately scoped ViewModels. Restoring after process death therefore requires saved state and durable data sources. Test these paths separately. A screen that survives rotation can still lose a draft or crash after background process termination because it relied on memory that no longer exists.
14. What is a ViewModel?
A ViewModel holds screen-related state and coordinates UI logic within a defined lifecycle scope. It can survive configuration recreation of its owner but does not survive process death by itself. Avoid keeping activity or view references in it. Use repositories and suitable saved-state mechanisms so a new ViewModel can reconstruct the screen when the process is recreated.
15. What is SavedStateHandle for?
SavedStateHandle stores small state needed to reconstruct a screen through the platform's saved-state restoration mechanism. It can retain a selected item ID or query across eligible recreation scenarios. It is not a durable database or a guarantee of persistence after every user dismissal or force-stop. Store essential application records separately and use saved values as reconstruction inputs.
16. What is the main thread responsible for?
The main thread processes UI events and much of the application component callback work. Blocking it with expensive computation, synchronous I/O, or lock contention can cause jank and unresponsiveness. Move suitable work off the main thread while returning UI updates through the correct context. Asynchronous code still needs cancellation, error handling, and ownership; simply starting another thread is insufficient design.
17. What is an ANR?
An Application Not Responding event occurs when the app fails to respond within a system-defined condition, such as blocked input handling or a component timeout. It differs from an ordinary crash. Investigate thread stacks, contention, I/O, and callback work rather than assuming CPU usage alone explains it. Exact timeout conditions depend on the component and platform behavior.
18. How do dp and sp differ?
Density-independent pixels are used for layout dimensions, while scale-independent pixels are used for text sizing so user font preferences are respected. Neither means a design can ignore real device sizes or accessibility settings. Test large fonts, different densities, and narrow windows. Fixed containers can clip content even when every dimension technically uses the recommended unit.
19. What are Android resources and qualifiers?
Resources separate content such as strings, images, and layouts from code, while qualifiers let the system choose variants for configuration conditions. They support localization and device adaptation. Supply sensible defaults and avoid assuming one resource variant is always selected. Test combinations such as language, orientation, and window size because individual variants can work while their combination fails.
20. How do minSdk, targetSdk, and compileSdk differ?
MinSdk defines the lowest supported platform level, compileSdk determines which platform APIs are available during compilation, and targetSdk declares the behavior level the app is designed for. They answer different questions. Compiling against a newer API does not make it safe on older devices; use supported compatibility mechanisms and runtime checks where required, and test target-dependent behavior changes.
21. What is Jetpack Compose?
Jetpack Compose is Android's declarative UI toolkit, where composable functions describe UI from state. The runtime can re-execute relevant functions as state changes. Composable bodies should avoid uncontrolled side effects and expensive repeated work. Compose changes UI construction, but it does not remove the need for lifecycle-aware data collection, accessibility, testing, or clear application architecture.
22. What is recomposition?
Recomposition re-executes affected composable functions when observed state changes require UI updates. It can happen more often or in different orders than a developer casually expects. Keep composables focused on describing UI and use effect APIs for appropriate side effects. Diagnose performance with measurements; a recomposition count alone does not establish whether a screen is slow.
23. What does remember do?
Remember retains a calculated value while the relevant composition instance remains, with keys controlling invalidation. It avoids recreating state or objects on every recomposition. It does not automatically persist data through activity recreation or process death. Choose a longer-lived or saveable state mechanism when the user expects the value to survive those events.
24. What does rememberSaveable do?
RememberSaveable retains eligible UI values through recomposition and supported saved-instance-state restoration, including many activity and system-initiated process recreation cases. Values must be saveable or use a suitable saver. It is not permanent storage and does not cover every complete user dismissal. Keep saved state small and store durable records in a repository or database.
Kotlin: save a small UI value
Requires a Compose-enabled Android module with Material 3. The counter demonstrates saved UI state; it is not a durable business record and is not guaranteed to survive every user dismissal.
25. What is state hoisting in Compose?
State hoisting moves ownership to a caller and passes the current value plus event callbacks into a UI component. This can make the component reusable and easier to test. Hoist only as high as the state must be shared or controlled. Putting every transient UI detail in a global store can create unnecessary coupling and lifecycle problems.
Kotlin: a state-hoisted control
The caller owns the favorite state and decides how to persist it. This component communicates intent through a callback rather than changing repository data inside its composable body.
26. What is unidirectional data flow?
Unidirectional data flow sends state toward the UI and user events toward the state owner, which computes the next state. It makes responsibility and transitions easier to reason about. The principle does not require one specific library or a giant reducer. Use explicit, testable ownership so multiple components do not mutate shared state through hidden paths.
27. What is a repository in Android architecture?
A repository provides a coherent interface to application data and coordinates sources such as local storage and network services. It should express data responsibilities rather than merely rename every API call. Decide how caching, synchronization, and errors are represented. Keeping that policy outside activities and composables makes it easier to test and reuse across screens.
28. What is a Kotlin coroutine?
A coroutine is a suspending computation managed within a coroutine context and scope. It can make asynchronous code easier to structure without dedicating a thread to every waiting operation. Suspension is not the same as automatically running on a background thread. Choose appropriate dispatchers and scopes, and handle cancellation and errors according to the operation's lifecycle.
29. What is a suspend function?
A suspend function can suspend and resume within coroutine machinery, but the suspend modifier does not by itself move work off the main thread. A function doing blocking I/O must still arrange a suitable execution context. Its caller should understand cancellation and error behavior. Prefer APIs that are safe to call from their documented context and do not hide uncontrolled work.
30. How do launch and async differ?
Launch starts a coroutine returning a Job, while async returns a Deferred result that can be awaited. Choose based on whether a value is needed and how work participates in structured concurrency. Async is not a blanket way to ignore failures. Exceptions and cancellation depend on the parent scope and supervision, so design that relationship rather than treating builders as interchangeable syntax.
31. What is Flow?
Flow represents an asynchronous stream of values with operators for transformation and collection. A typical cold flow performs its upstream work for each collection, while shared variants have different behavior. Understand the producer's lifecycle and cancellation contract. Collecting the same cold flow twice can duplicate a network request or subscription unless sharing is deliberately introduced.
32. What is StateFlow?
StateFlow is a hot state holder that exposes a current value and emits updates to collectors, with equality-based conflation. It is useful for observable screen state but does not inherently persist across process death. Represent state as coherent immutable values where practical. In-place mutation of an object can make updates difficult to observe or reason about.
33. How do StateFlow and LiveData differ?
Both can expose observable state, but LiveData has Android lifecycle-aware observation built in, while StateFlow belongs to Kotlin coroutines and requires an appropriate collection lifecycle in the UI. Flow offers a broader coroutine operator ecosystem. Choose based on the application architecture and interoperability needs, and avoid changing types without preserving lifecycle, cancellation, and testing behavior.
34. What is Room?
Room is a Jetpack persistence library that provides structured access to SQLite through entities, DAOs, and database definitions, with query validation and migration support. It does not automatically solve synchronization or every performance problem. Design indexes, transactions, and migration tests around real data. Keep database operations off the main thread using supported asynchronous APIs.
35. What is DataStore used for?
DataStore provides asynchronous storage for suitable application settings or small structured data, with supported preference and typed approaches. It can replace many settings use cases previously handled with SharedPreferences. It is not a relational database replacement. Choose Room or another appropriate store when queries, relationships, larger records, or transactional data modeling require that structure.
36. What is WorkManager?
WorkManager schedules persistent work that should remain eligible after the app process exits, subject to constraints and system scheduling. It supports retries and chaining but does not promise exact execution time. Use it for suitable deferrable work such as synchronization. The worker must still handle repeated execution, cancellation, and remote failures without creating inconsistent side effects.
37. What is a foreground service?
A foreground service performs user-noticeable ongoing work with required foreground visibility and compliance with platform rules. It is not a general exemption from background restrictions or a separate thread. Service types, permissions, start restrictions, and time limits vary by platform and target level. Choose it only when the task actually meets the intended user-facing use case.
38. How should runtime permissions be requested?
Request a permission when the user invokes a feature that needs it, explain the purpose where appropriate, and handle denial gracefully. Check current permission state before protected access because grants can change. Avoid requesting unrelated permissions at startup. Prefer platform mechanisms that reduce permission scope, such as a suitable picker, when they satisfy the feature's actual requirement.
39. How do internal storage and shared storage differ?
Internal app storage is scoped to the app's private data needs, while shared storage supports user-visible files and inter-app workflows under platform access rules. Choose according to ownership and expected retention. Do not assume an absolute filesystem path remains available or that broad storage access is necessary. Use supported content-URI and picker APIs for shared files where appropriate.
40. What kinds of Android tests are commonly used?
Local tests run on the development JVM for suitable logic, while instrumented tests run on a device or emulator for Android-dependent behavior. UI and integration tests exercise larger interactions. Choose the smallest test environment that can faithfully verify the requirement. A passing local test cannot establish that permissions, lifecycle restoration, rendering, or a real device integration behaves correctly.
Android Interview Questions and Answers for Intermediate
Examine practical state collection, effects, cancellation, queries, synchronization, background work, and security boundaries. Ask candidates to identify prerequisites and test failure paths.
41. How should a Fragment observe screen state safely?
Tie view-related observation to the fragment's view lifecycle, because its view can be destroyed before the fragment instance. For coroutine flows, use an appropriate lifecycle-aware collection pattern. Release view references when that lifecycle ends. Otherwise an observer can update a stale view, duplicate collectors after navigation, or retain an activity longer than intended.
Kotlin: collect for a Fragment view lifecycle
Call once per view creation, such as from onViewCreated, after the view lifecycle owner exists. The render callback should update that view and must not be stored elsewhere beyond its lifetime. Requires compatible AndroidX Fragment and Lifecycle coroutine dependencies.
42. How should Compose collect a Flow from a ViewModel?
Use a lifecycle-aware adapter such as collectAsStateWithLifecycle when it fits the Android UI, and render the resulting state. Keep collection ownership clear so hidden screens do not perform unnecessary work. The upstream sharing policy also matters. Lifecycle-aware collection stops or restarts collectors appropriately but does not automatically cancel every independent job already launched by the ViewModel.
Kotlin: lifecycle-aware Compose state collection
Requires the lifecycle-runtime-compose dependency and an appropriate lifecycle owner. The owner of counts remains responsible for upstream work and persistence; this function only adapts state for display.
43. When should LaunchedEffect be used?
Use LaunchedEffect for appropriate suspend work tied to a composable's presence and keys. Entering the composition starts the coroutine, changing keys restarts it, and leaving cancels it. Choose keys that represent the work's identity. Do not use it to bypass a missing data-layer design or accidentally restart a request on every unrelated state change.
44. When should DisposableEffect be used?
Use DisposableEffect for a composition-scoped registration or resource that requires cleanup when keys change or the composable leaves. Its cleanup should undo the corresponding setup. A lifecycle observer or listener is a typical example. Ensure keys reflect the objects involved, and avoid retaining an old owner or callback after recomposition changes the relevant dependency.
45. What problem does rememberUpdatedState solve?
RememberUpdatedState lets a long-lived effect access the latest value or callback without restarting the effect solely because that value changed. It is useful when effect lifetime and callback freshness have different requirements. It does not replace correct effect keys for the operation itself. Decide which changes should restart work and which should simply update what the running work reads.
46. When is derivedStateOf useful?
DerivedStateOf can reduce downstream updates when source state changes frequently but the meaningful derived result changes less often. A scroll threshold is a typical case. It has overhead and is not needed for every expression computed from state. Measure whether it actually reduces unnecessary work, and keep correctness independent of assumptions about how often recomposition occurs.
47. Why do stable keys matter in lazy lists?
Stable keys let a lazy layout associate item identity with the same logical record as positions change. This helps preserve appropriate item state and avoid confusing updates during insertion or reordering. Use durable unique IDs rather than list positions when records have identity. Keys do not fix mutable state bugs or guarantee that every expensive item operation is skipped.
48. How would you investigate excessive Compose recomposition?
Identify the slow interaction with profiling, then inspect state reads, parameter stability, allocation, and expensive work at the relevant composable boundaries. Distinguish harmless recomposition from costly layout, drawing, or main-thread work. Move or defer state reads only when the measured behavior justifies it. Avoid blindly adding remember because an incorrectly keyed cache can introduce stale results.
49. How should navigation arguments be designed?
Pass minimal stable identifiers or small validated values rather than large mutable domain objects. The destination can load authoritative data through its state holder. Handle missing, malformed, and unauthorized arguments, especially for external links. This reduces saved-state pressure and stale copies, while making process restoration and deep-link navigation easier to test consistently.
50. How should a screen restore after process death?
Persist essential records in durable storage and retain small reconstruction inputs through supported saved-state mechanisms. On recreation, rebuild screen state through repositories and handle unavailable or changed records gracefully. Test this independently from rotation. Avoid serializing an entire object graph into a Bundle; it can exceed limits and preserve data that is already stale.
51. How should coroutine dispatchers be selected?
Use an appropriate context for the operation: main-thread interaction, CPU-heavy computation, or blocking I/O have different needs. Suspend-friendly libraries may already manage their own execution and should be used according to their contract. Inject dispatchers when it improves deterministic tests. Dispatchers govern execution resources, while scopes govern ownership and cancellation; neither replaces the other.
52. What is structured concurrency?
Structured concurrency gives asynchronous work a parent scope so lifetimes, completion, and cancellation have an explicit relationship. It helps prevent tasks from outliving the operation that owns them. Design supervision deliberately when sibling failures should be isolated. Unbounded global launches make error handling and shutdown harder even when the individual coroutine code appears simple.
53. How should cancellation be handled in coroutine code?
Cooperate with cancellation through suspending APIs or explicit checks during long computation, and release resources in finally blocks where appropriate. Do not swallow CancellationException as an ordinary recoverable error. Blocking calls may need APIs that support cancellation or bounded timeouts. Test cancellation during partial work so resources and durable state remain consistent when the caller disappears.
Kotlin: cooperative cancellation in computation
The explicit checks bound cancellation latency during this CPU loop. Callers should not mutate the supplied array concurrently. This example needs kotlinx-coroutines and is not an Android UI integration test.
54. How do coroutineScope and supervisorScope differ?
CoroutineScope propagates a child failure through the scope in the normal structured-concurrency way, while supervisorScope allows child failures to be isolated according to supervision semantics. Individual async results still need proper awaiting and error handling. Choose supervision because partial success has a defined meaning, not merely to hide exceptions or keep every task running regardless of failure.
55. How should network errors be represented in UI state?
Represent loading, available data, and actionable error information coherently, distinguishing transient failures from authentication or validation problems. Preserve useful cached content when appropriate instead of replacing the whole screen with a generic failure. Define retry behavior and prevent duplicate requests. Avoid exposing raw exception text or sensitive server details directly to users.
56. How can search-as-you-type avoid stale results?
Debounce or otherwise bound request frequency, cancel obsolete work when supported, and associate results with the current query identity. Operators such as mapLatest can help, but cancellation alone may not stop every underlying network call. Verify that an older response cannot overwrite newer state. Handle blank queries, errors, and screen disposal explicitly rather than only testing successful typing.
Kotlin: cancel obsolete search work
This stream demonstrates debounce and cancellation, not complete screen error handling. mapLatest cancels prior work only when a new debounced value arrives, so an earlier result can arrive during the debounce window. Gate results against the current query identity when strict freshness is required. The injected search must cooperate with cancellation; model loading and failures separately and verify the selected coroutines version.
57. How do cold and shared flows affect network calls?
A cold flow commonly starts its upstream work for each collector, while sharing operators can expose one upstream execution to multiple collectors according to a chosen policy. Decide whether sharing should remain active while the UI is absent. Misunderstanding that policy can cause duplicate requests or unexpectedly persistent work. Test subscriber changes and errors, not just the first collection.
58. How should one-time UI actions be modeled?
Define whether the action must survive collector absence, recreation, or process death, then choose state or event delivery semantics that meet that requirement. Navigation or confirmation may be better represented as acknowledged state when loss would be harmful. Neither a Channel nor SharedFlow automatically guarantees exactly-once user-visible behavior across every lifecycle transition. Test repeated and missing collectors deliberately.
59. How would you design a Room DAO?
Expose queries and updates that match repository needs, with explicit ordering and appropriate asynchronous return types. Keep SQL readable and use parameters for values rather than concatenating user input. Add indexes based on actual access patterns. A DAO should not leak accidental database details into every UI component or conceal expensive full-table operations behind harmless-looking method names.
Kotlin: a parameterized Room query
This requires a Room database declaration and compiler setup in the containing project. Parameter binding is not authorization: the repository must select the correct account, and production indexing and pagination should reflect measured access patterns.
60. When should Room operations use a transaction?
Use a transaction when multiple database operations must succeed or fail together to preserve a local invariant. For example, updating a record and its associated pending-sync marker should not leave half-completed local state. A database transaction does not make a network call atomic with the server. Keep transactions bounded and design remote reconciliation separately.
61. How should Room schema migrations be tested?
Create databases at supported older schema versions with representative data, run the intended migration path, and verify both schema and preserved meaning. Test constraints, indexes, defaults, and edge records. A fresh-install test does not exercise migration. Destructive fallback can be acceptable for disposable caches but is inappropriate for irreplaceable user data unless loss is an explicit product decision.
62. How would you design an offline-first data flow?
Use a local authoritative read source for the UI and coordinate network synchronization through the repository. Define write queuing, conflict handling, retry, and freshness semantics explicitly. Offline-first does not mean every server operation can happen offline. Show pending or failed changes clearly and prevent a later synchronization response from silently erasing valid local user work.
63. How should a Worker report success, failure, and retry?
Return the result that matches whether work completed, failed permanently, or can reasonably be attempted again. Classify failures instead of retrying everything indefinitely. Retryable operations need idempotency and bounded backoff, and cancellation must remain distinguishable from ordinary failure. The scheduler's persistence does not make the remote action exactly once or guarantee immediate completion.
64. What is unique work in WorkManager?
Unique work associates a logical name with a work sequence and applies a policy when work with that name already exists. It can prevent accidental duplicate scheduling or replace obsolete work according to the chosen policy. Pick names and policies deliberately. Unique scheduling does not prove that a remote side effect cannot repeat after a crash or retry.
65. How should WorkManager constraints be used?
Declare conditions such as network availability or charging when they are genuine prerequisites or resource policies for the task. Constraints influence eligibility rather than promising an exact start time. Conditions can change while work runs, so operations still need interruption handling. Avoid overly restrictive constraints that make a user-visible synchronization appear permanently stuck without an explanation.
66. When should AlarmManager be considered instead of WorkManager?
Consider an alarm API for genuine time-based user features that require the platform's alarm semantics, while using WorkManager for suitable persistent deferrable work. Exact alarms have specific permissions and restrictions that vary by platform and use case. Do not use them as a general frequent background polling mechanism. Explain the timing requirement before selecting the scheduling API.
67. What must a foreground-service design account for?
Account for permitted start conditions, service type declarations, required permissions, notification behavior, and applicable time limits for the target platform. The work must remain appropriate for a foreground service and handle stopping or revocation. Avoid assuming a foreground notification guarantees unlimited execution. Test the actual device and target-SDK combinations that the app supports.
68. How should notification permission denial be handled?
Keep the application useful where possible and explain the consequence for the specific feature without repeatedly pressuring the user. Notification permission behavior and foreground-service visibility rules vary by platform and target level. Verify the current grant state and supported alternatives. A denied permission should not crash a workflow or silently pretend an important notification was delivered.
69. How should exported components be secured?
Export only components that need external callers, declare the intended exposure explicitly, and enforce permissions and input validation appropriate to the operation. Intent filters are not authentication. Consider whether a caller can trigger privileged actions through crafted extras or URIs. Test components directly with untrusted inputs instead of relying solely on the app's normal navigation paths.
70. How should deep-link input be validated?
Parse links structurally and validate scheme, host, path, parameters, and expected value ranges rather than using loose substring checks. Recheck authentication and authorization before displaying or modifying protected data. Domain verification helps routing but does not authorize an operation. Treat every link as an untrusted entry point, including links generated by your own backend or notification system.
Kotlin: parse a narrowly allowed deep link
This example accepts only the exact authority and encoded path shape shown. It rejects ports, user information, empty or extra path segments, percent-encoded identifiers, queries, and fragments. Replace the example host with the actual verified domain. The returned identifier still requires authentication and resource authorization before data access; parsing a link grants no permission.
71. What are Android App Links?
Android App Links use verified associations between an app and web domains to improve handling of eligible web links. They require correct app and domain configuration and still depend on device state and platform behavior. Verify association results in testing. A verified domain does not make arbitrary path parameters trustworthy or replace server-side authorization for linked resources.
72. Why does PendingIntent mutability matter?
A PendingIntent delegates a future operation under defined identity semantics, and mutability affects whether another party can modify permitted parts of the wrapped intent. Prefer immutable behavior when the use case does not require mutation, and use explicit targets. Check platform and target requirements. Incorrect flags or overly broad intents can create unintended capability exposure.
73. How should files be shared with another app?
Use a suitable content URI and narrowly scoped temporary URI permissions rather than exposing raw private filesystem paths. Configure a FileProvider or other supported provider only for the directories and operations required. Validate incoming shared content as well. Sharing a URI is an access decision, so avoid broad directory mappings or grants that outlast the actual workflow.
74. How would you handle URI-based content safely?
Treat the URI and its provider as an external data source: validate expected type and size, open streams through supported APIs, close resources, and handle revoked access or unavailable providers. Do not assume a content URI can be converted to a local path. Bound parsing and storage work so a malformed or enormous input cannot exhaust memory or block the UI.
75. How should application secrets be protected?
Avoid embedding long-lived backend secrets in the APK, because client code and resources can be inspected. Keep server authority on the server and use appropriately scoped user credentials. Android Keystore can protect supported cryptographic key material, but it does not make every runtime value unreachable. Define token storage, expiry, revocation, and backup behavior based on a concrete threat model.
76. How should HTTPS failures be handled?
Investigate certificate validity, hostname verification, trust configuration, clock issues, and connectivity rather than disabling validation. Return a controlled user-visible failure and collect sanitized diagnostics. Custom trust or pinning designs require careful lifecycle and rotation planning. A permissive trust manager may appear to fix connectivity while removing the protection HTTPS was intended to provide.
77. What causes memory leaks in Android apps?
Leaks occur when references keep objects reachable beyond their useful lifetime, such as a singleton retaining an activity or a listener retaining an obsolete view. Identify the ownership chain with appropriate memory tools. Garbage collection cannot free reachable objects merely because the UI is gone. Fix lifecycle registration and reference ownership instead of adding arbitrary null assignments everywhere.
78. How would you diagnose jank?
Measure the affected interaction on representative hardware and inspect frame timing, main-thread work, layout, drawing, allocations, and I/O. Separate startup delays from scrolling or animation problems. Averages can hide severe tail latency, so examine slow frames and realistic data sizes. Optimize the measured bottleneck and verify the improvement without sacrificing correctness or accessibility.
79. What is a Baseline Profile?
A Baseline Profile describes important execution paths so supported runtime tooling can optimize them earlier, improving selected startup or interaction performance. It complements rather than replaces efficient code and measurement. Generate and validate profiles for representative journeys and release configurations. A profile cannot fix blocking network access, excessive layout work, or a fundamentally inefficient algorithm.
80. How should dependency injection scopes be chosen?
Match a dependency's lifetime to the state and resources it owns, such as application-wide services versus screen-specific state. Avoid injecting short-lived UI objects into longer-lived components. Scoping is an ownership decision, not merely a convenience annotation. Test configuration changes and navigation because a scope that seems correct on first launch can retain stale state later.
Android Interview Questions and Answers for Experienced
Use architecture and incident scenarios to evaluate trade-offs, recovery, security boundaries, and operational ownership. Strong answers state assumptions and explain how to test them.
81. How would you design a scalable Android application architecture?
Organize UI state, domain decisions where needed, and data responsibilities around clear interfaces and ownership. Use modules when they improve independent development, build boundaries, or testability rather than maximizing module count. Define how errors, synchronization, and lifecycle transitions cross layers. A diagram is useful only if everyday changes and failure diagnosis remain understandable to the team.
82. How would you choose module boundaries in a large app?
Consider feature ownership, dependency direction, build performance, public interfaces, and shared data contracts. Keep foundational modules independent of concrete features and avoid a shared module that accumulates unrelated business logic. Measure the effect on iteration speed and integration complexity. A boundary should help teams change and test code safely, not merely distribute files into more folders.
83. How would you migrate a View-based UI to Compose?
Introduce Compose at suitable boundaries using supported interoperability, preserve behavior and accessibility, and migrate incrementally with measurable acceptance criteria. Keep state ownership clear while both UI systems coexist. Test lifecycle, focus, scrolling, and navigation transitions rather than only visual similarity. A complete rewrite is not automatically safer than a staged migration with known rollback points.
84. How would you investigate a production ANR?
Group reports by trace and user journey, inspect main-thread and lock-owner stacks, and correlate with device, version, and workload evidence. Reproduce representative conditions where possible. The thread shown as blocked may be waiting on work elsewhere, so trace dependencies. Validate the fix with targeted performance tests and rollout telemetry rather than assuming one moved function resolves the whole issue.
85. How would you investigate a crash that occurs only after restoration?
Reproduce both configuration recreation and process restoration with realistic navigation and saved data. Look for missing reconstruction inputs, invalid assumptions about singleton initialization, stale IDs, and oversized saved state. Compare logs without exposing personal data. The fix should establish durable ownership and graceful recovery, not simply catch the exception and return the user to an empty screen.
86. How would you design synchronization with an unreliable backend?
Persist pending changes locally, assign stable operation identities, and define retries, backoff, conflict handling, and acknowledgement semantics. Make synchronization observable to the user and operationally diagnosable. A timeout may mean the server completed the request but the response was lost. Reconcile that ambiguity instead of blindly repeating non-idempotent mutations or discarding local changes.
87. How would you resolve conflicts in an offline editing app?
Define conflict rules from the product's data model, such as version checks, field-level merging, or explicit user resolution. Preserve enough history to explain competing edits and avoid silently overwriting valuable work. Device timestamps alone may be unreliable. Test concurrent edits, deleted records, and delayed retries so the chosen policy behaves predictably beyond the happy path.
88. How would you prevent duplicate purchases or submissions?
Use stable operation identifiers and server-side idempotency or authoritative transaction handling, with local state recording pending and confirmed outcomes. Disabling a button reduces accidental taps but cannot handle network retries or process death alone. Reconcile uncertain responses with the server before creating another operation. Test duplicate delivery and interrupted acknowledgement rather than only sequential successful requests.
89. How would you design secure authentication state handling?
Separate credential storage, session validity, user identity, and UI presentation. Handle expiry, revocation, account switching, and concurrent refresh requests coherently, with server authorization remaining authoritative. Avoid retaining another user's cached data after logout or switching. A locally stored logged-in flag is not proof that a token is valid or that a requested resource belongs to the user.
90. How would you coordinate concurrent token refresh requests?
Ensure that simultaneous failed requests share or serialize a refresh operation rather than creating a refresh storm. Update credentials atomically and prevent an older response from replacing newer session state. Distinguish refresh failure from transient network failure and handle logout cancellation. Test multiple in-flight requests and account changes, because a single-request test misses the most dangerous races.
91. How would you design account switching safely?
Scope caches, queued work, database access, and network credentials to the correct account, and cancel or isolate work from the previous session. Decide which local data is retained and how it is protected. Test switching while requests or uploads are in flight. UI navigation alone does not prevent a late response from displaying another account's data.
92. How would you protect sensitive data in logs and analytics?
Define an explicit event schema, minimize collected fields, and redact or avoid credentials, private content, and stable identifiers that are not needed. Review crash attachments and network diagnostics as well as application logs. Apply access and retention controls to the resulting data. Debug-only assumptions can fail when a library logs automatically or a production build enables verbose diagnostics.
93. How would you review a third-party Android SDK?
Inspect permissions, exported components, network destinations, data collection, dependency provenance, update practices, and runtime behavior. Evaluate whether its benefits justify its access and maintenance cost. Test the merged manifest and release build, not only documentation claims. Assign ownership for monitoring changes because an SDK upgrade can alter privacy or startup behavior without changes in application code.
94. How would you diagnose excessive battery usage?
Correlate user journeys with background scheduling, wake locks, location requests, network frequency, and CPU work on representative devices. Identify whether the app is doing unnecessary work while not visible. Batch or defer work where the product permits and choose appropriate constraints. Verify the improvement through measurements; reducing one timer does not prove the application is energy-efficient overall.
95. How would you design location tracking responsibly?
Start from the user-visible purpose and required accuracy, frequency, and duration, then choose the minimum permissions and background mechanism that satisfy it. Handle revocation, approximate location, and unavailable sensors gracefully. Explain ongoing activity and provide a clear stop path. Test platform restrictions and power impact rather than assuming continuous access is guaranteed after an initial grant.
96. How would you manage large media uploads?
Use durable upload state, bounded memory streaming, retry or resumable protocols where supported, and an appropriate scheduling mechanism for the user-visible task. Track progress without implying completion before server acknowledgement. Handle process death, network changes, and expired credentials. A coroutine tied only to a screen may be unsuitable when the user expects the upload to continue after leaving it.
97. How would you design a download feature that survives interruption?
Persist the operation identity, destination, progress metadata, and verification requirements, using a suitable platform or application-managed download workflow. Validate partial content and resume only when the server contract supports it. Handle storage limits and revoked URI access. Completion should include integrity and usability checks rather than merely observing that a network stream closed without an exception.
98. How would you handle schema changes across staged app releases?
Design migrations for every supported installed version and coordinate server compatibility so old and new clients can coexist. Preserve data semantics and test upgrade paths with realistic records. Avoid assuming all users update immediately. A rollback or older client may encounter data written by a newer version, so explicitly define compatibility and recovery limits before rollout.
99. How would you test lifecycle-sensitive behavior?
Exercise navigation, backgrounding, recreation, process restoration, and cancellation at meaningful operation boundaries. Use controlled fakes for deterministic logic tests and device-level tests for actual framework behavior. Assert user-visible state and resource cleanup rather than callback counts alone. Distinguish a simulated recreation from real process loss, because they preserve different objects and reveal different defects.
100. How would you test coroutine-based state holders?
Use controllable dispatchers and test schedulers, fake dependencies, and assertions about state transitions and cancellation. Cover overlapping requests, exceptions, and timing boundaries without relying on arbitrary sleeps. Ensure all test jobs are completed or cancelled. Deterministic coroutine tests verify logic, while real network, database, and lifecycle interactions still require appropriate integration evidence.
101. How would you test WorkManager behavior?
Use supported testing tools for worker logic, input handling, constraints, and chain behavior, then add device tests for the scheduling paths the feature depends on. Verify idempotency and recovery after interruption. Do not interpret a unit test calling doWork directly as proof of real scheduling or timing. Record which layer was tested and which system behaviors remain assumptions.
102. How would you reduce flaky UI tests?
Identify nondeterministic dependencies such as real network data, animations, clocks, asynchronous work, and shared accounts. Use controlled inputs and synchronization mechanisms appropriate to the UI framework instead of fixed delays. Keep selectors tied to meaningful semantics. Investigate flakes as evidence of missing observability or race conditions rather than simply increasing timeouts until failures become less frequent.
103. How would you design accessibility acceptance criteria?
Define meaningful labels, roles, focus order, touch targets, contrast, and behavior with assistive technologies and large text. Include dynamic content and error states, not only the first screen. Test with real accessibility services and user journeys. An automated scanner can catch some issues but cannot determine whether a complex task is understandable or independently usable.
104. How would you support tablets and resizable windows?
Design from available window space and task continuity rather than assuming a fixed phone orientation. Use adaptive navigation and layouts, preserve state across resizing, and test keyboard, mouse, and multi-window interactions where relevant. Avoid stretching a narrow layout without reconsidering information hierarchy. A device category alone is a weak proxy for the actual space available to the app.
105. How would you investigate slow startup?
Measure cold, warm, and relevant startup paths in release-like builds, then inspect initialization, dependency creation, disk access, class loading, and first meaningful rendering. Defer nonessential work while preserving correctness. Avoid shifting all work just after the first frame if it immediately blocks interaction. Validate on representative lower-end devices and realistic stored data, not only a developer workstation emulator.
106. How would you manage image-loading performance?
Request images sized appropriately for their display, use bounded caches and supported asynchronous loading, and avoid retaining large decoded bitmaps unnecessarily. Measure memory, scrolling behavior, and cancellation when items leave the screen. Caching everything can create memory pressure and stale content. Include poor networks, rapidly changing lists, and lifecycle transitions in performance testing.
107. How would you diagnose an out-of-memory crash?
Inspect allocation patterns, retained objects, bitmap sizes, and peak workload rather than assuming a single memory leak. Compare device memory classes and reproduce the relevant data volume. Use profiling and heap evidence to distinguish temporary spikes from persistent retention. Fix ownership or working-set size, and verify behavior under pressure instead of merely increasing a cache limit.
108. How would you secure a WebView feature?
Minimize enabled capabilities, validate navigation destinations, avoid exposing privileged JavaScript bridges to untrusted content, and handle file and URI access deliberately. Keep platform components updated and enforce authentication outside assumptions about page origin alone. Test redirects, mixed content, and external links. A WebView is an embedded web security boundary, not just another text-rendering widget.
109. How would you validate an app-link rollout?
Check domain association files, signing identity, manifest filters, server responses, and device verification state across the supported environments. Test cold starts, existing tasks, malformed parameters, and unauthenticated users. Routing success does not prove resource authorization. Ensure browser fallback and error behavior are useful when verification fails or a user changes their preferred link handler.
110. How would you respond to a client-side security vulnerability?
Assess reachable behavior and server exposure, contain the affected capability where possible, and prepare a tested fix with clear rollout monitoring. Rotate compromised credentials if needed and preserve sanitized evidence. Remember that old app versions may remain installed. Server-side controls and compatibility decisions often determine containment effectiveness while the client update propagates.
111. How would you plan a target-SDK upgrade?
Review platform behavior changes relevant to the app's permissions, background work, UI, storage, and component exposure, then test those paths across supported OS versions. Update dependencies and manifest declarations deliberately. A successful build does not verify changed runtime behavior. Roll out with monitoring and a plan for features whose assumptions no longer hold under the new target.
112. How would you maintain compatibility across Android versions?
Define the supported platform matrix, use AndroidX or other supported compatibility APIs where appropriate, and guard newer platform calls correctly. Test behavior rather than only API availability, including target-dependent changes. Avoid broad version branches scattered throughout UI code. Encapsulate compatibility decisions near the platform boundary so they remain reviewable and removable as support evolves.
113. How would you design feature-flagged mobile rollouts?
Define safe defaults, cached behavior, evaluation ownership, and what happens when flag delivery fails. Ensure flag combinations are testable and do not bypass authorization. Mobile clients can remain offline or run old versions, so a server flag is not always an immediate kill switch. Plan rollback and data compatibility before exposing a partially deployed feature.
114. How would you make production behavior observable?
Collect privacy-conscious signals for failures, performance, network outcomes, and important workflow transitions, with enough version and device context to diagnose patterns. Correlate client symptoms with backend evidence using appropriate identifiers. Avoid excessive logging or sensitive payload capture. Observability should answer concrete operational questions and include missing or delayed telemetry, not just a dashboard of successful events.
115. How would you design resilience to poor connectivity?
Use bounded timeouts, retry policies appropriate to operation semantics, cached data, and clear pending states. Detecting a connected network does not prove the backend is reachable. Handle captive portals, intermittent loss, and requests whose results are unknown after a timeout. Test transitions during active work instead of only airplane mode before the app starts.
116. How would you decide between polling, push, and streaming updates?
Compare freshness requirements, battery and network cost, delivery reliability, server capabilities, and app lifecycle. Push can signal that data should be refreshed but should not be assumed to deliver every event exactly once. Streaming needs reconnection and background-policy consideration. Choose an approach with a reconciliation path so missed notifications or disconnected sessions do not permanently corrupt the user's view.
117. How would you handle concurrent local database updates?
Express invariants with transactions and constraints, choose appropriate conflict policies, and keep related state transitions atomic. Observe changes through a coherent repository interface. An in-memory mutex alone may not protect against every process or database writer. Test competing writes and cancellation, and define whether the user should see a retry, conflict, or merged result.
118. How would you design backup and restore behavior?
Classify data by sensitivity, durability, and whether it is safe or meaningful to restore on another installation or device. Configure supported backup rules and test restored credentials, identifiers, and local databases carefully. Do not assume every cached value should be backed up. A restored session marker without valid credentials can produce confusing or insecure application behavior.
119. How would you evaluate build and release reliability?
Use reproducible dependency selections where practical, protected signing and release credentials, automated checks, and staged distribution with rollback or mitigation plans. Test optimized release builds because shrinking and configuration can differ from debug builds. Record artifact provenance and monitor post-release health. A green debug test suite does not prove the signed production artifact behaves identically.
120. How would you evaluate a senior Android engineer's architectural judgment?
Ask the candidate to explain state ownership, lifecycle, persistence, concurrency, security boundaries, and recovery for a concrete user journey. Introduce process death, permission denial, or a delayed server response and examine how the design adapts. Strong answers identify assumptions and propose useful tests. Reward maintainability and evidence-based trade-offs rather than a preference for a particular architecture acronym or library.
Android Documentation and Further Reading
Use these primary Android references to verify lifecycle, state, persistence, background execution, security, and testing behavior. Confirm details against the supported OS and target SDK combinations and selected library versions, then test the actual user journeys on representative devices.
Similar Posts
