Android Interview Questions and Answers SDE I to SDE (original) (raw)

Last Updated : 6 Jun, 2026

Android is an open-source operating system based on Linux, created by Andy Rubin. It is the most widely used mobile OS in the world, holding a major share of the smartphone market. Because of its popularity, Android development remains a highly in-demand career path.

1. What do you understand by the term "Android" and what is the latest version of Android?

Android is a Linux-based open-source operating system developed by Google for mobile and smart devices. It is widely used in smartphones, tablets, wearables, TVs, and automotive systems. It provides a flexible platform for modern app development with regular updates and security improvements.

2. What's Activity in Android?

An Activity in Android represents a single screen with a user interface where the user can interact with the app. It is a core component of Android and acts as an entry point for user interaction in an application. Each activity has its own lifecycle managed by the Android system.

****3.**Why is XML used for frontend development in Android?

XML is used in Android for frontend development because it allows developers to design user interfaces separately from the app’s logic. It makes the UI structure clear, reusable, and easier to manage compared to writing UI in code. It also helps in supporting different screen sizes and layouts efficiently.

4. What are the components of the Android Application?

Android applications are built using four main components that define how an app behaves and interacts with the system. These components work together to provide functionality, user interaction, and background processing in an Android app.

5. What is the Dalvik Virtual Machine?

Dalvik Virtual Machine (DVM) is a process virtual machine used in older versions of Android to run Android applications. It executes .dex (Dalvik Executable) files, which are optimized for low memory usage and better performance on mobile devices. DVM is designed specifically for mobile environments with limited resources.

6. What are the differences between Dalvik and ART?

Feature Dalvik Virtual Machine (DVM) Android Runtime (ART)
Compilation Uses Just-In-Time (JIT) compilation Uses Ahead-Of-Time (AOT) compilation
Performance Slower execution Faster execution
App Installation Faster installation Slightly slower installation (due to pre-compilation)
Battery Usage Higher battery consumption Better battery efficiency
Memory Usage Less optimized More optimized memory management
Usage Used in older Android versions Used in modern Android versions (Android 5.0+)

Read More:Dalvik vs ART

7. How does an Android App Work?

An Android app works by compiling source code into an APK file, which is then installed and executed on a device using the Android Runtime (ART). When launched, the system loads the app components and manages execution through Android’s lifecycle and system services.

8. What is Toast in Android?

A Toast in Android is a small pop-up message that appears on the screen for a short duration and disappears automatically without user interaction. It is used to display simple feedback or notifications to the user.

9. What are Services in Android?

A Service in Android is an application component that runs in the background to perform long-running operations without a user interface. It helps the app continue tasks even when the user is interacting with other applications or the app is not in the foreground.

10. What is a Content Provider in Android?

A Content Provider in Android is a component used to manage and share data securely between different applications. It acts as a central repository that allows controlled access to data such as contacts, images, audio, videos, or database records using a standard interface.

11. What are Broadcast Receivers in Android?

A Broadcast Receiver in Android is a component that listens for system-wide or app-level broadcast messages and responds to them. These broadcasts can come from the system (like battery low, boot completed) or from other apps.

12. What is Gradle and write down its usage in Android?

Gradle is an open-source build automation tool used in Android development to compile, package, test, and deploy applications. It processes source files such as Java, Kotlin, and XML, manages dependencies, and generates the APK or AAB file used for installation.

13. What is a Fragment in Android?

A Fragment is a reusable and modular part of an Activity that represents a portion of the user interface and its behavior. Multiple fragments can be combined within a single activity to create flexible and dynamic UI designs.

14. What's RecyclerView in Android & How it works?

RecyclerView is a flexible and efficient Android UI component used to display large sets of data in a scrolling list or grid. It improves performance by reusing existing item views instead of creating new ones for every item.

15. What's the Difference Between Intent and Intent filters?

An **Intent is a messaging object used to request an action from another app component, such as starting an Activity or Service. An **Intent Filter defines which intents a component can respond to and is declared in the AndroidManifest.xml file.

Feature Intent Intent Filter
**Definition A message used to request an action. A declaration of the intents a component can handle.
**Purpose Starts Activities, Services, or Broadcast Receivers. Specifies which intents a component can receive.
**Usage Created in Java/Kotlin code. Defined in AndroidManifest.xml.
**Example Opening another Activity. Allowing an Activity to open web links or share data.

**Read More:Difference Between Implicit Intent and Explicit Intent in Android

16. What is the AndroidManifest.xml?

AndroidManifest.xml is a configuration file that contains essential information about an Android application. It informs the Android system about the app's components, permissions, hardware requirements, and other configuration details before the app is executed.

17. What's Android SDK and its Components?

The Android SDK (Software Development Kit) is a collection of tools, libraries, and APIs used to develop, test, and debug Android applications. It provides everything needed to build and run Android apps on devices and emulators.

**18. What are the Disadvantages of Android?

Android is a popular and flexible operating system, but it also has some limitations. Due to its open-source nature and availability across many devices, developers may face challenges related to security, compatibility, and updates.

19. Explain the Activity Lifecycle in brief.

These are the different stages of the Activity Lifecycle:

**20. Why do we need to call setContentView() in onCreate() of an Activity class?

The setContentView() method is used to set the user interface layout for an Activity. It is typically called inside onCreate() because this method is executed when the Activity is first created, ensuring that the UI is loaded and ready before the user interacts with the application.

21. Explain the Fragment Lifecycle in Brief.

The Fragment Lifecycle consists of a series of callback methods that manage a Fragment from its creation to destruction. It is similar to the Activity lifecycle but is closely tied to the lifecycle of its host Activity.

Method Description
onAttach() Called when the Fragment is attached to an Activity.
onCreate() Initializes the Fragment and its components.
onCreateView() Creates and returns the Fragment's UI layout.
onViewCreated() Called after the Fragment's view has been created.
onStart() Fragment becomes visible to the user.
onResume() Fragment is active and ready for user interaction.
onPause() Fragment loses focus and user interaction stops.
onStop() Fragment is no longer visible.
onDestroyView() Cleans up resources related to the Fragment's view.
onDestroy() Final cleanup before the Fragment is destroyed.
onDetach() Fragment is detached from the host Activity.

Read More:Fragment Lifecycle in Android.

22. What is the difference between a Fragment and an Activity?

Feature Activity Fragment
Definition A complete screen with UI. A reusable part of an Activity's UI.
Dependency Can exist independently. Must be hosted by an Activity.
Lifecycle Has its own lifecycle. Has its own lifecycle but depends on the Activity.
Reusability Less reusable. Highly reusable across multiple Activities.
Usage Represents a full user screen. Represents a portion of a screen.

23. What's Context in Android?

Context in Android is a reference to the current state of the application or Activity. It provides access to application-specific resources, services, and system features, allowing components to interact with the Android system.

24. Top Image Loading Libraries in Android.

Image loading libraries are used in Android to efficiently load, cache, and display images from local storage or the internet. They help improve app performance, reduce memory usage, and provide smooth image rendering.

**25. What is View in Android?

A View is the basic building block of the Android user interface (UI). It represents a rectangular area on the screen that displays content and handles user interactions such as clicks, touches, and text input.

26. Difference Between View and ViewGroup in Android

Feature View ViewGroup
Definition Basic UI element. Container that holds Views and other ViewGroups.
Purpose Displays content and handles user input. Organizes and manages child views.
Children Cannot contain other Views. Can contain multiple Views and ViewGroups.
Examples TextView, Button, ImageView, EditText LinearLayout, RelativeLayout, FrameLayout, ConstraintLayout

27. What is Kotlin Coroutine on Android?

Kotlin Coroutines are a lightweight concurrency framework used to perform asynchronous and background tasks without blocking the main UI thread. They simplify handling long-running operations such as network requests, database access, and file processing.

28. How Garbage Collector Works in Android?

The **Garbage Collector (GC) in Android is an automatic memory management mechanism that identifies and removes objects that are no longer being used by the application. This helps free up memory and prevents memory leaks, improving app performance.

29. Describe the architecture of your last app.

When developers work on a real mobile application whose nature is dynamic and will expand its features according to the user’s need, then it is not possible to write core logic in activities or fragments. To structure the project’s code and to give it a modular design(separated code parts), architecture patterns are applied to separate the concerns. The most popular Android architectures used by developers are the following:

So you have to tell the architecture of the last app you have developed during the college time project or in a real industry project.To learn about the concept refer this articleAndroid Architecture Patterns.

30. MVC vs MVP vs MVVM architecture and which one we should choose?

Feature MVC (Model-View-Controller) MVP (Model-View-Presenter) MVVM (Model-View-ViewModel)
Components Model, View, Controller Model, View, Presenter Model, View, ViewModel
Communication View ↔ Controller ↔ Model View ↔ Presenter ↔ Model View ↔ ViewModel ↔ Model
Coupling Tight coupling between View and Controller Loosely coupled Very loosely coupled
Testability Difficult Good Excellent
Code Maintenance Moderate Better Best
Data Binding Not supported Not supported Supported
Complexity Simple Moderate Moderate to High
Boilerplate Code Less More Less (with Data Binding)
Suitable For Small applications Medium-sized applications Large and scalable applications
Android Usage Rarely used Used in some projects Most preferred in modern Android development

**Which one should we choose?

For modern Android applications, **MVVM is generally recommended because it provides clear separation of concerns, easier maintenance, better scalability, and seamless integration with Android Jetpack libraries..

**Read More: MVC Vs MVP Vs MVVM Architecture Pattern in Android.

31. How to Reduce APK size in Android?

APK size can be reduced by removing unused code and resources, optimizing assets, and generating device-specific packages. This improves app performance, download speed, and storage efficiency.

**Read More: Reduce APK Size in Android.

32. What's the Android jetpack and its Key Benefits?

Jetpack is nothing but a set of software components, libraries, tools, and guidance to help in developing great Android apps. Google launched **Android Jetpack in 2018. Key Benefits of Android Jetpack

33. What are the different software components of Android Jetpack?

The software components of Android Jetpack has been divided into 4 categories:

34. What's Jetpack Compose and its Benefits?

Jetpack Compose is a modern UI toolkit recently launched by Google which is used for building native Android UI. It simplifies and accelerates the UI development with less code, Kotlin APIs, and powerful tools.

35. What are the **Architecture Components of Android?

Android Architecture Components are a set of libraries provided by Google to help build robust, maintainable, and lifecycle-aware applications. They simplify common development tasks and improve app architecture.

36. How to Improve RecyclerView Scrolling Performance in Android?

**Read More: How to Improve RecyclerView Scrolling Performance in Android?

37. What is Volley Library in Android?

Volley is an HTTP networking library developed by Google that simplifies sending and managing network requests in Android applications. It provides features such as request queuing, caching, image loading, and efficient network communication.

38. What's Retrofit in Android?

Retrofit is a type-safe HTTP client library for Android and Java developed by Square. It simplifies API communication by converting REST API responses into Kotlin/Java objects automatically, making network operations easier and more efficient.

39. Describe MVVM

Model — View — ViewModel (MVVM) is the industry-recognized software architecture pattern that overcomes all drawbacks of MVP and MVC design patterns. MVVM suggests separating the data presentation logic(Views or UI) from the core business logic part of the application.

**The separate code layers of MVVM are:

**Read More: MVVM (Model View ViewModel) Architecture Pattern in Android

40. What are the reasons your Android app is lagging?

Android apps may lag due to inefficient code, excessive resource usage, or poor UI rendering, which affects performance and user experience.

41. What is AIDL?

AIDL (Android Interface Definition Language) is used to enable communication between different Android applications or processes through Inter-Process Communication (IPC).

42. What is ANR and How can it be Prevented in Android?

**ANR (Application Not Responding****)** occurs when an Android app fails to respond to user input within a specified time, causing the system to display an ANR dialog.

**Prevention of ANR:

43. What is Android NDK and why is it useful?

The NDK (Native Development Kit) is a tool that allows developers to write part of their code in C/C++ rather than Java/Koltin. It allows the app to interact with low level system components and provide access to native libraries to increase performance. NDK can be useful for cases in which you need to do one or more of the following:

44. Explain the JUnit test in brief.

JUnit is a popular unit testing framework used in Android and Java applications to test individual units of code. It helps developers verify that methods and classes work as expected, improving code quality and reliability.

45. What's Dagger and When to use Dagger?

Dagger is a Dependency Injection (DI) framework automatically sets up dependency injection by generating boilerplate code at compile time. Dagger is faster, more efficient and well suited for Android Development unlike other DI frameworks.

When to use a dagger?

Project Size Recommended DI Approach
Small Manual DI/Service Locator
Medium Service Locator/Dagger
Larger Dagger

46. What's LiveData in Android Architecture Component and its Advantages?

LiveData is a lifecycle-aware observable data holder class that is part of Android Jetpack Architecture Components. It allows the UI to automatically update whenever the underlying data changes while respecting the lifecycle of Activities and Fragments.

**Advantages:

LiveData_Component-(1)

**Read More:Jetpack Architecture Components in Android.

47. What's Data Binding in Android?

Data Binding is an Android library that allows UI components in XML layouts to directly bind to data sources, reducing boilerplate code.

48. What is Room in Android Architecture Component?

Room is an Android Architecture Component that provides an abstraction layer over SQLite, making database operations easier and more efficient.

Room_Component

Read More:Jetpack Architecture Components in Android.

49. What is ViewModel in Android?

ViewModel is a lifecycle aware jetpack component in Android whose main responsibility is to store and manage UI related data while surviving sudden lifecycle changes like screen rotation. It helps in separation of concerns to separate UI code with business logic. This helps is managing the app more easily and making it more maintainable.

ViewModelComponent

50. What is Android KTX?

Android KTX (Kotlin Extensions) is a set of Kotlin libraries that make Android development more concise, readable, and developer-friendly.

Additional Questions in Android

1. What is Pagination?

Pagination is a technique used to load and display large amounts of data in smaller chunks or pages instead of loading everything at once.

**Read More: Paging Library in Android

2. What is an inline function?

An inline function is a Kotlin function whose code is copied directly at the call site during compilation, reducing function call overhead and improving performance.

inline fun greet(name: String) {
println("Hello, $name")
}

3. What is Multidex?

Multidex is an Android feature that allows an application to exceed the 65,536 method limit of a single DEX (Dalvik Executable) file by using multiple DEX files.

4. What is the difference between Launch and Async in Kotlin Coroutines?

Both **Launch and **Async has a similar use case, which is to start coroutines in Kotlin, but the basic difference between them is how they return the results and how they are used.

To read more, refer to the articleLaunch vs Async in Kotlin Coroutines.

5. Explain the Android App Startup Process: Cold, Warm and Hot Start

When we run an app, the startup experience varies on whether the app is starting from scratch, or its partially in memory or its already running in the foreground.

These states are divided into three ways:

6. Explain @JVMStatic, @JVMOverloads, and @JVMField in Kotlin.

The JVMStatic, JVMOverloads, and JVMField annotations help Kotlin interoperate smoothly with Java by modifying how Kotlin properties and functions are exposed to Java.

7. What is onViewCreated() in Fragment lifecycle?

onViewCreated() is a Fragment lifecycle callback that is invoked immediately after the Fragment's view has been created using onCreateView().

override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState)

val button = view.findViewById<Button>(R.id.btnSubmit)
button.setOnClickListener {
    // Handle button click
}

}

`

onViewCreated() is the preferred place to initialize views, set adapters, attach listeners, and observe data because the Fragment's view hierarchy is fully created at this point.