INTERVIEW

Ace Your Android Developer Interview

Master the most asked questions, showcase your expertise, and land your dream Android role.

12 Questions
120 min Prep Time
5 Categories
STAR Method
What You'll Learn
This page equips Android developer candidates with curated interview questions, expert model answers, and actionable tips to boost confidence and performance during technical and behavioral interviews.
  • Real‑world scenario based answers using the STAR method
  • Clear outlines for quick review
  • Evaluation criteria to self‑grade your response
  • Common red flags to avoid
  • Practical tips from senior Android engineers
Difficulty Mix
Easy: 40%
Medium: 35%
Hard: 25%
Prep Overview
Estimated Prep Time: 120 minutes
Formats: Multiple Choice, Behavioral, Coding Exercise
Competency Map
Kotlin/Java Programming: 20%
Android SDK & Architecture: 25%
UI/UX Design: 15%
Testing & Debugging: 15%
Performance Optimization: 15%
Collaboration & Agile: 10%

Core Android

Explain the Android activity lifecycle and how you handle configuration changes such as screen rotation.
Situation

In a previous project, our app crashed whenever the device was rotated because the activity was recreated and state was lost.

Task

I needed to ensure the UI retained its state across configuration changes without memory leaks.

Action

Implemented onSaveInstanceState/onRestoreInstanceState for lightweight data and used ViewModel with LiveData to survive configuration changes. For heavy resources, I leveraged retained fragments and set android:configChanges in the manifest where appropriate.

Result

The app handled rotations smoothly, no crashes, and user data persisted, improving user satisfaction scores by 15%.

Follow‑up Questions
  • How would you handle a long‑running network request during rotation?
  • What are the drawbacks of using android:configChanges?
Evaluation Criteria
  • Clarity of lifecycle sequence
  • Correct use of state‑preservation techniques
  • Awareness of modern Jetpack components
  • Understanding of trade‑offs
Red Flags to Avoid
  • Confusing onPause with onStop
  • Suggesting to store large objects in Bundle
Answer Outline
  • Describe each lifecycle callback (onCreate, onStart, onResume, onPause, onStop, onDestroy)
  • Explain why onDestroy may not be called on rotation
  • Show how to preserve UI state with onSaveInstanceState
  • Introduce ViewModel as a modern solution
  • Mention configChanges as a last‑resort option
Tip
Memorize the order of callbacks and always default to ViewModel for state retention.
What is the difference between a Fragment and a custom View, and when would you choose one over the other?
Situation

Our team needed a reusable component that displayed a list with header actions across multiple screens.

Task

Decide whether to implement it as a Fragment or a custom View.

Action

Evaluated requirements: lifecycle awareness, need for child fragments, and navigation handling. Chose a Fragment because it required its own lifecycle, could host a RecyclerView with its own ViewModel, and needed to participate in back‑stack navigation. Implemented the UI as a Fragment with a separate layout file, exposing an interface for the host activity.

Result

The component was easily reused in three different activities, reduced code duplication by 30%, and navigation behaved consistently.

Follow‑up Questions
  • Can a custom View host a ViewModel?
  • How do you communicate between a Fragment and its host activity?
Evaluation Criteria
  • Accurate distinction between Fragment and View
  • Appropriate justification for choice
  • Mention of communication patterns
Red Flags to Avoid
  • Saying Fragments are always better than Views
Answer Outline
  • Define Fragment (UI + lifecycle, can host child fragments)
  • Define custom View (lightweight UI widget)
  • Compare use‑cases: navigation, lifecycle, reuse, complexity
  • State the decision criteria
Tip
Use Fragments when you need lifecycle, navigation, or child fragments; use custom Views for simple, reusable UI elements.
How do you implement dependency injection in an Android app? Mention at least one library and its core concepts.
Situation

Our codebase grew to 200+ classes, making manual object creation cumbersome and hard to test.

Task

Introduce a DI framework to manage object graphs and improve testability.

Action

Adopted Dagger 2 (later Hilt) for its compile‑time validation. Defined @Module classes to provide dependencies, used @Inject constructors for classes, and scoped components with @Singleton and @ActivityScoped. Replaced ServiceLocator pattern with constructor injection, enabling unit tests with mock implementations.

Result

Reduced boilerplate by 40%, eliminated runtime injection errors, and increased unit test coverage from 55% to 80%.

Follow‑up Questions
  • What are the differences between Hilt and plain Dagger?
  • How would you inject a ViewModel with Hilt?
Evaluation Criteria
  • Correct library name and annotations
  • Understanding of scopes
  • Link to testability
Red Flags to Avoid
  • Confusing @Provides with @Inject
Answer Outline
  • Introduce DI concept and why needed
  • Name Dagger/Hilt and key annotations (@Inject, @Module, @Provides, @Singleton)
  • Explain component scopes
  • Show example of constructor injection
  • Highlight testability benefits
Tip
Start with Hilt for simpler setup; it handles component creation automatically.
Describe how you would improve the startup time of an Android application.
Situation

Our app’s cold start time exceeded 5 seconds, leading to poor user ratings.

Task

Identify bottlenecks and reduce launch latency.

Action

Enabled Android App Bundle to deliver only required resources, deferred initialization of heavy libraries using the SplashScreen API, moved non‑essential work to background threads with WorkManager, applied lazy loading for Dagger modules, and profiled with Android Studio’s Startup Profiler to pinpoint slow init blocks. Also optimized the Application class and removed unnecessary reflection calls.

Result

Cold start dropped to 2.3 seconds, warm start under 800 ms, and Play Store rating improved by 0.3 stars.

Follow‑up Questions
  • What is the role of the SplashScreen API in startup optimization?
  • How do dynamic feature modules affect startup?
Evaluation Criteria
  • Use of profiling tools
  • Specific optimization techniques
  • Quantifiable results
Red Flags to Avoid
  • Vague statements like "make code faster" without details
Answer Outline
  • Measure startup with profiler
  • Use App Bundle & dynamic feature modules
  • Defer heavy init (libraries, DB)
  • Lazy‑load DI modules
  • Optimize Application class
  • Avoid reflection
Tip
Always start with measurement; optimize the biggest contributors first.

Architecture & Design Patterns

Explain Model‑View‑ViewModel (MVVM) in Android and how it differs from MVP.
Situation

When joining a legacy codebase that used MVP, I needed a more lifecycle‑aware pattern.

Task

Advocate for MVVM and demonstrate its benefits.

Action

Described MVVM components: View (Activity/Fragment), ViewModel (holds UI data, survives config changes), LiveData (observable data holder). Compared to MVP where Presenter manually updates the View and must handle lifecycle. Showed how ViewModel reduces boilerplate and improves testability.

Result

Team migrated two screens to MVVM, cutting presenter code by 40% and eliminating memory leaks related to view references.

Follow‑up Questions
  • How would you handle one‑time events in MVVM?
  • Can ViewModel hold a reference to Context?
Evaluation Criteria
  • Clear component definitions
  • Correct lifecycle handling
  • Understanding of differences
Red Flags to Avoid
  • Saying ViewModel replaces the View entirely
Answer Outline
  • Define View, ViewModel, LiveData
  • Explain data flow (View observes LiveData)
  • Contrast with Presenter’s role in MVP
  • Highlight lifecycle awareness and testability
Tip
Emphasize that ViewModel never holds a reference to UI elements.
What are sealed classes in Kotlin and how can they be used to model UI state?
Situation

We needed a type‑safe way to represent loading, success, and error states for a network call in the UI layer.

Task

Design a Kotlin solution that the UI could observe safely.

Action

Created a sealed class UiState with subclasses Loading, Success<T>, and Error(val message). The ViewModel exposed LiveData<UiState>. The Fragment used when‑expression to handle each subclass, ensuring compile‑time exhaustiveness. Added data class for Success payload and used sealed class to prevent invalid states.

Result

UI handling became concise, compile‑time safe, and bugs related to unhandled states dropped to zero in code reviews.

Follow‑up Questions
  • How does a sealed class differ from an enum class?
  • Can sealed classes have state?
Evaluation Criteria
  • Correct definition
  • Practical UI example
  • Understanding of exhaustiveness
Red Flags to Avoid
  • Confusing sealed with abstract class
Answer Outline
  • Define sealed class and its exhaustiveness guarantee
  • Show example with Loading/Success/Error subclasses
  • Explain usage in ViewModel + LiveData
  • Mention when‑expression in UI
Tip
Sealed classes are perfect for representing a closed set of UI states.
Describe the Repository pattern and its role in clean architecture for Android apps.
Situation

Our app mixed network and database logic directly in ViewModels, making testing difficult.

Task

Introduce a clean separation of data sources.

Action

Implemented a Repository interface that abstracts data operations. Created concrete classes: RemoteRepository (Retrofit) and LocalRepository (Room). The Repository decides whether to fetch from cache or network, exposing a Flow<Result<T>>. ViewModel depends only on the Repository, enabling unit tests with fake implementations.

Result

Test coverage increased, code became modular, and swapping data sources required only changes in Repository implementations.

Follow‑up Questions
  • How would you handle error propagation in the Repository?
  • What benefits does the Repository provide for offline support?
Evaluation Criteria
  • Clear abstraction explanation
  • Link to clean architecture layers
  • Testing advantage
Red Flags to Avoid
  • Skipping mention of data source abstraction
Answer Outline
  • Explain purpose: abstract data sources
  • Show interface with methods
  • Detail concrete implementations (remote/local)
  • Describe interaction with ViewModel
Tip
Think of Repository as the single source of truth for the domain layer.
How would you implement a custom navigation solution without using the Jetpack Navigation component?
Situation

A legacy project targeted API 21 where Jetpack Navigation wasn't feasible.

Task

Create a lightweight, maintainable navigation system.

Action

Designed a NavigationManager singleton that holds a stack of Fragment tags. Used a sealed class NavCommand (Add, Replace, Pop). Activities called NavigationManager.navigate(command). The manager performed FragmentTransactions with custom animations and handled back‑stack updates. Integrated with ViewModel to preserve state across process death via SavedStateHandle.

Result

Navigation logic was centralized, reduced duplicated transaction code by 70%, and passed code‑review for maintainability.

Evaluation Criteria
  • Clear architecture
  • Handling of back stack
  • State preservation
Red Flags to Avoid
  • Ignoring lifecycle implications
Answer Outline
  • Explain need for custom solution
  • Define NavCommand sealed class
  • Describe NavigationManager responsibilities
  • Show FragmentTransaction handling
  • Mention back‑stack and state preservation
Tip
Keep navigation logic out of Activities/Fragments to avoid scattering transaction code.

Testing & Debugging

What strategies do you use for unit testing Android ViewModels?
Situation

Our team needed reliable unit tests for business logic without Android dependencies.

Task

Set up a testing approach for ViewModels.

Action

Used JUnit5 with Kotlin Coroutines Test library. Injected a FakeRepository into the ViewModel. Leveraged LiveDataTestUtil or Turbine to collect Flow emissions. Mocked Android components with Mockito‑Kotlin where necessary. Ran tests on the JVM, not on an emulator.

Result

Achieved 85% unit test coverage for ViewModels, catching regressions early and reducing UI‑related bugs by 30%.

Follow‑up Questions
  • How do you test ViewModel with SavedStateHandle?
  • What is the role of InstantTaskExecutorRule?
Evaluation Criteria
  • Use of proper testing libraries
  • Isolation from Android framework
  • Verification of state changes
Red Flags to Avoid
  • Attempting to run Android instrumentation tests for pure unit logic
Answer Outline
  • Use JUnit5 + coroutine test rule
  • Inject fake or mock repositories
  • Test LiveData/Flow emissions
  • Avoid Android framework classes
Tip
Keep ViewModel pure; it should have no Android context.
Explain how you would use Espresso to test a RecyclerView item click and verify the resulting UI change.
Situation

A feature required clicking a list item to open a detail screen, and we needed an automated UI test.

Task

Write an Espresso test that verifies the navigation and UI content.

Action

Implemented a test with ActivityScenarioRule. Used onView(withId(R.id.recyclerView)).perform(RecyclerViewActions.actionOnItemAtPosition<RecyclerView.ViewHolder>(2, click())). Then asserted that the detail TextView displayed the correct title using onView(withId(R.id.detailTitle)).check(matches(withText(expectedTitle))). Added IdlingResource for asynchronous data loading.

Result

The test reliably caught a regression where the wrong item was passed, preventing a UI bug from reaching production.

Follow‑up Questions
  • How do you handle flaky tests caused by animations?
  • What is the purpose of IdlingResource?
Evaluation Criteria
  • Correct use of RecyclerViewActions
  • Synchronization handling
Red Flags to Avoid
  • Hard‑coding view positions without waiting for data
Answer Outline
  • Launch activity with ActivityScenarioRule
  • Perform click on RecyclerView item using RecyclerViewActions
  • Add IdlingResource if data loads async
  • Assert UI change with onView and matches
Tip
Always synchronize with IdlingResources to avoid flaky UI tests.
Describe how you would debug a memory leak caused by a Context reference in an Android app.
Situation

Our app’s memory usage kept growing after navigating between screens, leading to OOM crashes on low‑end devices.

Task

Identify and fix the leak.

Action

Connected Android Studio Profiler to capture heap dumps. Used the LeakCanary library to pinpoint a static singleton holding a reference to an Activity context via a non‑static inner class. Refactored the singleton to use Application context and made the inner class static. Added WeakReference where appropriate and removed unnecessary listeners in onDestroy.

Result

Memory usage stabilized, leak reports disappeared, and crash rate dropped by 90% on affected devices.

Follow‑up Questions
  • What are the risks of using Application context for UI components?
  • How does LeakCanary report a leak?
Evaluation Criteria
  • Tool usage
  • Root cause analysis
  • Correct mitigation steps
Red Flags to Avoid
  • Suggesting to ignore the leak
Answer Outline
  • Use Profiler or LeakCanary to detect leak
  • Identify static reference holding Activity context
  • Replace with Application context or WeakReference
  • Remove listeners in lifecycle callbacks
Tip
Never store Activity or View references in static fields.
How do you ensure your Android app is accessible for users with disabilities? Mention tools and code practices.
Situation

Our product needed to meet accessibility standards for a government contract.

Task

Implement and verify accessibility features across the app.

Action

Added contentDescription to all ImageViews, used TalkBack to navigate the UI, ensured proper focus order with android:focusable, and provided scalable text via sp units. Leveraged Android Accessibility Test Framework (ATF) in CI to detect missing labels. Conducted manual testing with TalkBack and screen magnifier, and fixed contrast issues using the Material Design color guidelines.

Result

App passed the accessibility audit, received certification, and user satisfaction scores for accessibility improved by 25%.

Follow‑up Questions
  • What is the role of android:importantForAccessibility?
  • How do you test color contrast programmatically?
Evaluation Criteria
  • Coverage of key accessibility aspects
  • Tool integration
Red Flags to Avoid
  • Ignoring TalkBack testing
Answer Outline
  • Add contentDescription, labels, and hints
  • Use TalkBack for manual testing
  • Run ATF lint checks in CI
  • Ensure proper focus order and contrast
Tip
Treat accessibility as a first‑class requirement, not an afterthought.
ATS Tips
  • Kotlin
  • Java
  • Android SDK
  • Jetpack
  • MVVM
  • Coroutines
  • Retrofit
  • Room
  • Dagger
  • Hilt
  • LiveData
  • ViewModel
  • RecyclerView
  • Performance
  • Testing
  • CI/CD
Download our Android Developer resume template
Practice Pack
Timed Rounds: 45 minutes
Mix: Core Android, Architecture & Design Patterns, Testing & Debugging

Ready to land your dream Android job?

Get Started with Resumly

More Interview Guides

Check out Resumly's Free AI Tools