CODE MASTER

Software Engineering & Technology Articles

Android Interview Questions 2026 (Top 120+ Q&A)

Android Interview Questions 2026 (Top 120+ Q&A)

🕑 31 mins

Q1: Explain the Android Architecture
Android architecture consists of five layers: Linux Kernel (hardware abstraction), Libraries (native C/C++ libraries), Android Runtime (ART and Dalvik VM), Application Framework (core functionality), and Applications (user-installed apps).

Q2: What are the main components of Android App?
Activities (UI screens), Services (background tasks), Content Providers (data sharing), and Broadcast Receivers (respond to system broadcasts).

Q3: What is Context in Android?
Context is an abstract class providing access to application resources, databases, preferences, and system services. Types include Application Context and Activity Context.

Q4: When should you use Application Context vs Activity Context?
Use Application Context for singleton objects and long-lived operations. Use Activity Context for UI-related operations and when the context needs to be tied to activity lifecycle.

Q5: What is the Android Manifest file?
AndroidManifest.xml declares essential app information including package name, components, permissions, hardware/software requirements, and API levels.

Q6: What is an Intent?
An Intent is a messaging object used to communicate between Android components. It describes what action to perform and can pass data between activities, services, and broadcast receivers.

Q7: What is the difference between Implicit and Explicit Intent?
Explicit Intent specifies the target component directly (class name). Implicit Intent doesn’t specify the target, and the system finds the appropriate component based on action, category, and data.

Q8: What is a PendingIntent?
A PendingIntent wraps an Intent, allowing other applications to execute the intent with the permissions of the original application. Used in notifications, alarms, and widgets.

Q9: What is ADB?
Android Debug Bridge is a command-line tool for communicating with Android devices, allowing installation, debugging, shell access, and file transfer.

Q10: What is AndroidX?
AndroidX is the successor to the Android Support Library. It provides backward compatibility for new Android features and is organized into individual libraries with better naming conventions.


Q11: Explain the Activity Lifecycle
onCreate → onStart → onResume → (running) → onPause → onStop → onDestroy. onCreate is called when creating, onResume when visible and interactive, onPause when losing focus, onStop when not visible, and onDestroy before destruction.

Q12: What are the different launch modes in Android?
Standard (default, creates new instance), singleTop (reuses if on top), singleTask (single instance in task), singleInstance (single instance system-wide).

Q13: What is an ANR and how do you prevent it?
Application Not Responding occurs when the UI thread is blocked for >5 seconds. Prevent by moving long operations to background threads using coroutines, WorkManager, or background tasks.

Q14: How do you pass data between Activities?
Use Bundle objects with Intent.putExtra(). Create a Bundle, add key-value pairs, put it in the Intent, start the activity, and retrieve data using getExtra().

Q15: What is a Parcelable?
Parcelable is an interface for passing objects between Android components. It’s faster than Serializable but requires more code. Implement it by overriding writeToParcel() and createFromParcel().

Q16: What is the difference between Serializable and Parcelable?
Serializable is a Java interface using reflection (slower). Parcelable is Android-specific, manually implemented, and much faster for inter-process communication.

Q17: How do you return data from a child Activity?
Use startActivityForResult() to launch the activity, set a result with setResult() in the child activity, and handle it in onActivityResult() in the parent activity.

Q18: What is the main thread?
The main thread (UI thread) handles all UI updates and user interactions. Only UI operations should run on this thread to prevent ANR (Application Not Responding) errors.


Q19: What is a Fragment?
A Fragment is a reusable component representing a portion of the UI within an Activity. Multiple fragments can exist in one activity, and they have their own lifecycle but depend on the parent activity.

Q20: What is the Fragment Lifecycle?
onAttach → onCreate → onCreateView → onViewCreated → onStart → onResume → (visible) → onPause → onStop → onDestroyView → onDestroy → onDetach.

Q21: What is FragmentManager?
FragmentManager manages fragment transactions in an activity. It handles adding, removing, and replacing fragments using FragmentTransaction.

Q22: What is a FragmentTransaction?
FragmentTransaction allows you to perform multiple fragment operations (add, remove, replace) as a single atomic operation, with beginTransaction() and commit().

Q23: What is addToBackStack()?
addToBackStack() adds the fragment transaction to the back stack, allowing the user to navigate back to the previous fragment state.

Q24: What are the advantages of using Fragments?
Advantages include reusability across activities, flexible UI layouts, easier handling of different screen sizes, modular code structure, and better memory management.


Q25: What is a Service?
A Service is a component that performs background tasks without a user interface. It can run indefinitely even if the app is closed. Types include Started Services and Bound Services.

Q26: What is the difference between Service and IntentService?
Service runs on the main thread and requires manual thread management. IntentService runs on a worker thread, handles requests sequentially, and stops automatically when done.

Q27: What is WorkManager?
WorkManager is a library for deferrable, guaranteed background work that needs to run even if the app exits or device restarts. It handles scheduling, cancellation, and retry logic.

Q28: What is BroadcastReceiver?
BroadcastReceiver is a component that responds to system-wide broadcasts like battery low, device boot, or network changes. Register it in manifest or dynamically.

Q29: What is a Content Provider?
Content Provider manages shared app data that can be queried or modified by other applications through a consistent interface using URIs.

Q30: What is Doze Mode?
Doze Mode is a power-saving feature limiting background activity when the device is inactive. Apps must use AlarmManager or WorkManager for reliable scheduling.


Q31: What is ConstraintLayout?
ConstraintLayout allows positioning UI elements using constraints relative to the parent or other views. It’s flexible, efficient, enables responsive designs, and is now the default layout in Android Studio.

Q32: What is dp, sp, and px in Android?
dp (Density-independent Pixels) scales based on screen density. sp (Scale-independent Pixels) is like dp but also considers user font size preferences. px is actual pixels on screen (not recommended).

Q33: What is the difference between View.GONE and View.INVISIBLE?
INVISIBLE hides the view but maintains its space in layout. GONE hides the view and removes it from layout calculations.

Q34: What is the View class?
The View class is the base class for all UI elements in Android. All widgets and layouts inherit from View. It handles drawing and event processing.

Q35: Explain the difference between match_parent and wrap_content
match_parent makes view as large as its parent (minus padding). wrap_content sizes view just large enough for its content.

Q36: What is View Binding?
A feature generating binding classes for XML layouts, providing type-safe and null-safe view references without findViewById().

Q37: What is Data Binding?
A library supporting declarative layouts, binding UI components to data sources directly in XML, reducing boilerplate code and supporting two-way binding.

Q38: What is Material Design?
Google’s design system providing guidelines, components, and tools for creating intuitive, beautiful user interfaces across platforms.

Q39: What is a CoordinatorLayout?
A super-powered FrameLayout for coordinating animations and transitions between child views, especially with AppBarLayout and scrolling.

Q40: How do you handle different screen sizes and densities?
Use dp/sp units, provide alternative resources in qualified directories (e.g., layout-land, drawable-hdpi), use ConstraintLayout, and test on multiple devices.


Q41: What is RecyclerView?
RecyclerView is a flexible view for efficiently displaying large lists of data. It recycles views to improve performance and memory usage, replacing the older ListView.

Q42: What are the main components of RecyclerView?
The main components are RecyclerView (container), Adapter (binds data to views), LayoutManager (positions views), and ViewHolder (holds view references).

Q43: What is ViewHolder pattern?
ViewHolder caches view references to avoid repeated findViewById() calls, significantly improving RecyclerView scrolling performance.

Q44: What is the difference between RecyclerView and ListView?
RecyclerView is more flexible with mandatory ViewHolder pattern, supports multiple layout managers, item animations, and better performance through view recycling.

Q45: What are LayoutManagers in RecyclerView?
LayoutManagers control how items are arranged: LinearLayoutManager (vertical/horizontal list), GridLayoutManager (grid), StaggeredGridLayoutManager (staggered grid).

Q46: What are DiffUtil and ListAdapter?
DiffUtil calculates differences between two lists efficiently. ListAdapter combines RecyclerView.Adapter with DiffUtil for automatic list updates and animations.


Q47: What are the different ways to store data in Android?
SharedPreferences (key-value pairs), SQLite Database (relational), File Storage (files), Room (abstraction over SQLite), and DataStore.

Q48: What is SharedPreferences?
SharedPreferences is a key-value storage system for storing small amounts of primitive data. It’s simple, fast, and suitable for user preferences or app settings.

Q49: What is the difference between apply() and commit()?
commit() writes changes synchronously and returns a boolean result. apply() writes changes asynchronously and returns void, generally preferred for performance.

Q50: What is Room Persistence Library?
Room is an ORM library that provides an abstraction layer over SQLite. It offers compile-time verification, easier database access, and LiveData/Flow support.

Q51: What are the three main components of Room?
Entity (database table), DAO (Data Access Object with query methods), Database (holder providing DAOs).

Q52: What is an Entity in Room?
An Entity is a class annotated with @Entity representing a table in the database. Each property represents a column, with @PrimaryKey defining the unique identifier.

Q53: What is a DAO in Room?
DAO (Data Access Object) is an interface defining database operations. It uses annotations like @Query, @Insert, @Update, @Delete for database access with compile-time verification.

Q54: What is DataStore?
A data storage solution replacing SharedPreferences, supporting asynchronous operations, type safety, and consistency using Coroutines and Flow.


Q55: What is Retrofit?
Retrofit is a type-safe HTTP client for Android converting REST API into Java/Kotlin interfaces with automatic JSON parsing.

Q56: How do you create a Retrofit instance?
Use Retrofit.Builder() to configure base URL, add converters (like Gson), add interceptors if needed, and build() to create the instance.

Q57: What is the difference between Call and Response in Retrofit?
Call represents an asynchronous HTTP request that can be executed. Response contains the HTTP response including status code, headers, and body.

Q58: What is an Interceptor in Retrofit?
An Interceptor intercepts HTTP requests and responses for logging, adding headers, or handling errors. Implement OkHttp Interceptor interface and add to OkHttpClient.

Q59: What is OkHttp?
An HTTP client library that Retrofit uses under the hood, handling connections, caching, request/response interceptors.

Q60: What is Gson?
A library for converting Java/Kotlin objects to JSON and vice versa, commonly used with Retrofit for serialization.

Q61: What is the difference between @Query and @Path in Retrofit?
@Query adds parameters to the query string (URL?param=value). @Path replaces a placeholder in the URL path ({id}).

Q62: How do you handle network errors in Retrofit?
Use try-catch blocks, implement Callback with onResponse() and onFailure() methods, or use coroutines with try-catch for exception handling.


Q63: What are Kotlin Coroutines?
A concurrency design pattern for asynchronous programming, allowing writing sequential-looking code that executes asynchronously without callback hell.

Q64: Explain suspend functions in Kotlin
Functions marked with ‘suspend’ keyword that can be paused and resumed, only callable from coroutines or other suspend functions.

Q65: What are coroutine scopes?
Common scopes include GlobalScope (app lifetime), viewModelScope (ViewModel lifetime), lifecycleScope (Lifecycle lifetime). lifecycleScope is recommended to prevent leaks.

Q66: What is the difference between launch and async?
launch starts a coroutine returning a Job, used for fire-and-forget. async returns a Deferred, used when you need a result from the coroutine.

Q67: What is withContext() in coroutines?
withContext() switches the coroutine context to perform operations in a different thread (like IO thread) and switches back when done. Useful for thread switching.

Q68: What are coroutine dispatchers?
Dispatchers control which thread a coroutine runs on: Dispatchers.Main (main thread), Dispatchers.IO (background IO), Dispatchers.Default (CPU-intensive).

Q69: What are Kotlin Flows?
A cold asynchronous stream that emits multiple values sequentially over time, built on coroutines, better than LiveData for some use cases.

Q70: What is the difference between Flow and LiveData?
Flow is more flexible, supports backpressure, multiple operators, not lifecycle-aware by default. LiveData is lifecycle-aware, simpler, Android-specific.


Q71: What is ViewModel?
ViewModel stores and manages UI-related data surviving configuration changes. It lives from first request until Activity finishes or Fragment is detached permanently.

Q72: Explain the ViewModel Lifecycle
ViewModel is created when first requested and retained during configuration changes (like screen rotation). It’s cleared only when the associated Activity finishes or Fragment is permanently detached. The onCleared() method is called before ViewModel destruction, allowing cleanup of resources.

Q73: What is the advantage of using ViewModel?
Data persistence across configuration changes, separation of concerns, lifecycle awareness, and prevention of memory leaks when used correctly.

Q73: What is LiveData?
An observable lifecycle-aware data holder that only updates active observers, preventing crashes and memory leaks.

Q74: What is MutableLiveData?
MutableLiveData is a subclass of LiveData that allows you to post values from outside. Use setValue() on main thread or postValue() from background threads.

Q75: What is the difference between setValue() and postValue()?
setValue() updates LiveData on the main thread immediately. postValue() queues the update on the main thread, useful from background threads.

Q76: What is the MVVM architecture?
Model-View-ViewModel separates UI (View) from business logic (ViewModel) and data (Model). ViewModel exposes data streams, View observes and displays them.

Q77: What is the Clean Architecture?
A layered architecture separating code into independent layers (Presentation, Domain, Data) with dependency inversion, making code testable and maintainable.

Q78: What is the Repository pattern?
An abstraction layer mediating between data sources (network, database, cache) and business logic, providing a clean API for data access.

Q79: What are Use Cases (Interactors)?
Classes encapsulating single business logic operations, part of the Domain layer in Clean Architecture, keeping logic reusable and testable.

Q80: What is the Observer pattern?
A pattern where objects (observers) subscribe to another object (subject) to receive automatic notifications of state changes.


Q81: What is Jetpack Compose?
Android’s modern declarative UI toolkit for building native UI with Kotlin code instead of XML layouts. It simplifies UI development with less code and powerful tools.

Q82: What is the difference between imperative and declarative UI?
Imperative (traditional Views) manually updates UI state. Declarative (Compose) describes UI as a function of state, and the framework automatically handles updates when state changes.

Q83: What are Composable functions?
Functions annotated with @Composable that describe UI elements. They can be called from other composables and automatically recompose when their state changes.

Q84: What is recomposition in Jetpack Compose?
Recomposition is the process where Compose re-executes composable functions when their state changes, updating only the parts of UI that changed for efficiency.

Q85: What is remember in Compose?
remember stores a value across recompositions. Without it, values would be reset every time the composable recomposes. Use rememberSaveable for surviving configuration changes.

Q86: What is State in Jetpack Compose?
State represents data that can change over time. When state changes, Compose automatically recomposes affected composables. Created using mutableStateOf() or remember { mutableStateOf() }.

Q87: What is the difference between remember and rememberSaveable?
remember retains values across recompositions but loses them on configuration changes. rememberSaveable survives both recompositions and configuration changes like screen rotation.

Q88: What are Modifiers in Compose?
Modifiers allow you to decorate or configure composables – changing size, padding, background, click behavior, etc. They’re applied in a chain using dot notation.

Q89: What is LazyColumn and LazyRow?
LazyColumn and LazyRow are Compose’s equivalent to RecyclerView, efficiently displaying large lists by composing only visible items and recycling them as you scroll.

Q90: What is Side Effect in Compose?
Side effects are operations that happen outside the scope of a composable function. Use LaunchedEffect, DisposableEffect, or SideEffect to safely handle side effects in Compose.


Q91: What is Dependency Injection?
A design pattern where objects receive dependencies from external sources rather than creating them, improving testability and decoupling.

Q92: What is Hilt?
Hilt is a dependency injection library built on Dagger, providing standard components and simplified setup for Android apps.

Q93: What is the difference between Dagger and Hilt?
Hilt is built on Dagger but provides Android-specific components, easier setup, and reduced boilerplate. Dagger is more flexible but complex.

Q94: What are the common annotations in Hilt?
@HiltAndroidApp (initializes Hilt), @AndroidEntryPoint (injects dependencies), @Inject (marks injectable dependencies), @Module (provides dependencies), and @Provides (creates instances).


Q95: What is the difference between Java and Kotlin?
Kotlin is more concise, has null safety, extension functions, and coroutine support. Java is more verbose but widely used. Kotlin is now the preferred language for Android development.

Q96: What are Kotlin data classes?
Classes primarily holding data with auto-generated equals(), hashCode(), toString(), copy(), and componentN() functions.

Q97: What is a sealed class?
A class that restricts inheritance to a known set of subclasses, useful for representing restricted type hierarchies like states or results.

Q98: Explain Kotlin extension functions
Functions that extend a class with new functionality without modifying or inheriting from it, adding methods to existing classes.

Q99: What are nullable types in Kotlin?
Types that can hold null values, declared with ‘?’ suffix (String?), requiring explicit null handling for safety.

Q100: What is the Elvis operator?
The ‘?:’ operator providing a default value when the left expression is null: val length = name?.length ?: 0

Q101: What are inline functions?
Functions marked ‘inline’ where the compiler copies function code at call site instead of creating a function call, improving performance for lambdas.

Q102: What is lazy initialization?
Delaying object creation until first use using ‘lazy’ delegate, improving startup performance and memory usage.


Q103: What types of testing exist in Android?
Unit tests (JUnit, Mockito), Integration tests, UI tests (Espresso, UI Automator), Screenshot tests, and End-to-End tests.

Q104: What is the difference between instrumented and local tests?
Local tests run on JVM (fast, test/), instrumented tests run on Android device/emulator (slower, androidTest/).

Q105: What is Espresso?
Google’s testing framework for writing reliable Android UI tests that interact with app components.

Q106: What is Mockito?
A mocking framework for creating mock objects in unit tests, allowing you to isolate the code being tested.

Q107: What is Test-Driven Development (TDD)?
A methodology where you write tests before implementation code, ensuring code is testable and meets requirements.

Q108: How do you debug memory leaks in Android?
Use LeakCanary library, Android Profiler, analyze heap dumps, ensure proper lifecycle handling, and avoid holding context references.

Q109: What is Android Profiler?
A suite of tools in Android Studio for real-time monitoring of CPU, memory, network, and energy usage.

Q110: What is ProGuard/R8?
Code shrinker and obfuscator that removes unused code, optimizes bytecode, and makes reverse engineering harder.


Q111: How do you optimize app performance?
Use ProGuard/R8, optimize images, lazy load, avoid memory leaks, use RecyclerView properly, reduce overdraw, profile regularly, and minimize APK size.

Q112: What is overdraw and how to reduce it?
Overdraw occurs when pixels are drawn multiple times. Reduce by flattening layouts, removing unnecessary backgrounds, using ConstraintLayout, and enabling overdraw debugging.

Q113: What is method count and why does it matter?
Android has a 64K method reference limit per DEX file. Exceeding requires MultiDex, which impacts performance and build time.

Q114: How do you optimize image loading?
Use Glide or Coil for caching, loading, and efficient memory management. Provide multiple resolutions, use WebP format, and implement proper placeholder/error handling.

Q115: What is Strict Mode?
A development tool for detecting accidental disk/network access on main thread and other policy violations during development.

Q116: What are Android App Bundles?
A publishing format that defers APK generation to Google Play, delivering optimized APKs for each device configuration, reducing download size by up to 35%.

Q117: What is the difference between Cold Start, Warm Start, and Hot Start?
Cold start launches app from scratch (slowest). Warm start recreates activity but process exists. Hot start brings existing activity to foreground (fastest).

Q118: How do you reduce app startup time?
Lazy initialize objects, defer heavy operations, optimize Application onCreate(), use Content Providers carefully, and avoid synchronous disk I/O on main thread.

Q119: What is ANR Watchdog?
A library for detecting ANRs in production by monitoring the UI thread and reporting when it’s blocked for too long.

Q120: What is Baseline Profiles?
Baseline Profiles specify critical code paths that should be ahead-of-time (AOT) compiled, improving app startup time and runtime performance by up to 40%.


Q121: How do Stability and Skippability affect Compose performance?
Stable: If an object’s properties don’t change, or if the system is notified when they do, the compiler marks it as stable.

Skippable: If a composable’s parameters are all stable, Compose can “skip” re-executing that function if the arguments haven’t changed during recomposition.

Optimization: Using @Immutable or @Stable annotations on data classes can fix performance issues where composables re-render unnecessarily because the compiler couldn’t “prove” the data hadn’t changed.

Q122: What is a TEE?
A Trusted Execution Environment (TEE) is a secure, isolated area of a device’s main processor that runs a separate, minimal operating system parallel to the primary OS (like Android). It ensures that even if the main OS is completely compromised by a virus or root-level malware, the attacker cannot access the TEE’s memory or execution space. It acts as a digital vault, managing the device’s most sensitive operations—such as cryptographic key handling and biometric processing—in a way that is physically invisible to the rest of the phone.

Q123: What is a Android Keystore?
a security framework that allows applications to store and manage cryptographic keys (like those used for encryption or digital signatures) in a way that makes them extremely difficult to extract or misuse.

Its primary purpose is to ensure that key material never enters the application’s memory space. Instead of the app handling the key itself, the app sends data to the Keystore, the Keystore performs the math (encryption/decryption), and then sends only the result back to the app.

Q124: What makes the Android Kernel different from standard Linux?
The Android Kernel is a fork of Linux optimized for mobile. It includes unique patches for power and memory constraints, such as the Low Memory Killer and Wakelocks, and relies on Binder for inter-process communication, which standard Linux does not use by default.

Q125: What is Dalvik and ART?
Dalvik was the process virtual machine (VM) used in early versions of the Android operating system to execute applications. Named after a fishing village in Iceland, it was the engine responsible for running the code of every Android app until it was replaced by the Android Runtime (ART) in Android 5.0 Lollipop.


MORE Articles

Share

Rate This

Post Rating: 4.7/5

Be the first to rate this post.