Android

Android

Top Interview Questions

About Android

What is Android?

Android is an open-source operating system designed primarily for mobile devices such as smartphones and tablets. It is developed and maintained by Google and based on the Linux kernel. Android powers billions of devices worldwide and is the most widely used mobile operating system globally.

Android provides a platform for developers to build applications using programming languages like Java and Kotlin, and it supports a vast ecosystem of apps available through app stores such as Google Play Store.


History of Android

Android was originally developed by Android Inc., a company founded in 2003. In 2005, Google acquired Android Inc., and since then, it has continued to develop the operating system.

The first commercial Android device was released in 2008, marking the beginning of Android’s dominance in the mobile industry. Over time, Android has evolved through numerous versions, each introducing new features, performance improvements, and enhanced security.


Key Features of Android

1. Open Source Nature

Android is open source, meaning its source code is freely available under the Android Open Source Project (AOSP). This allows manufacturers and developers to modify and customize the OS according to their needs.


2. User-Friendly Interface

Android provides a highly intuitive and customizable user interface. Users can:

  • Change themes and wallpapers

  • Add widgets to the home screen

  • Customize layouts and settings


3. Multitasking Support

Android supports multitasking, allowing users to run multiple applications simultaneously. Features like split-screen mode enhance productivity.


4. Wide Device Compatibility

Android runs on a wide range of devices, including:

  • Smartphones

  • Tablets

  • Smart TVs

  • Wearables

  • Automotive systems


5. Rich App Ecosystem

The Android ecosystem includes millions of apps across categories such as:

  • Social media

  • Gaming

  • Productivity

  • Education

  • Entertainment

Most apps are distributed through the Google Play Store.


6. Customization

Android allows extensive customization compared to other operating systems. Users can:

  • Install custom launchers

  • Use widgets

  • Modify system settings


7. Security Features

Android includes multiple security mechanisms such as:

  • App sandboxing

  • Regular security updates

  • Google Play Protect (malware scanning)


Android Architecture

Android is built on a layered architecture consisting of several components:

1. Linux Kernel

The foundation of Android is the Linux kernel, which handles:

  • Hardware abstraction

  • Memory management

  • Process management

  • Device drivers


2. Hardware Abstraction Layer (HAL)

HAL provides standard interfaces that allow Android to communicate with hardware components like cameras, sensors, and audio devices.


3. Android Runtime (ART)

ART is responsible for executing Android applications. It converts compiled bytecode into machine code for efficient execution.


4. Native Libraries

Android includes a set of native C/C++ libraries that provide functionalities such as:

  • Graphics rendering

  • Database management

  • Media playback


5. Application Framework

This layer provides high-level services used by applications, such as:

  • Activity Manager

  • Window Manager

  • Content Providers

  • Resource Manager


6. Applications Layer

This is the top layer where user applications reside, including:

  • System apps (Phone, Messages, Settings)

  • Third-party apps installed by users


Android Development

Android apps are primarily developed using:

  • Java

  • Kotlin (modern preferred language)

Developers use integrated development environments (IDEs) such as Android Studio, which provides tools for coding, debugging, and testing applications.


Components of an Android App

An Android application typically consists of:

1. Activities

An activity represents a single screen with a user interface.

2. Services

Services run in the background to perform long-running operations.

3. Broadcast Receivers

These components respond to system-wide broadcast messages.

4. Content Providers

Content providers manage shared data between applications.


Android Versions

Android versions are released regularly with improvements and new features. Each version is traditionally named after desserts (e.g., Cupcake, KitKat, Lollipop), although recent versions use numeric naming.

Examples of Android versions include:

  • Android 10

  • Android 11

  • Android 12

  • Android 13

  • Android 14

Each update typically introduces:

  • UI enhancements

  • Performance improvements

  • Security upgrades


Advantages of Android

1. Open Source and Free

Android’s open-source nature allows manufacturers to customize it without licensing fees.


2. Large Market Share

Android dominates the global smartphone market, making it an attractive platform for developers.


3. Extensive App Ecosystem

With millions of apps available, users have access to a wide range of functionalities.


4. Customizability

Users and manufacturers can customize Android extensively.


5. Developer-Friendly

Android provides robust tools, documentation, and community support for developers.


Disadvantages of Android

1. Fragmentation

There are many devices with different screen sizes, hardware configurations, and Android versions, which can complicate app development.


2. Security Risks

Because it is open source and widely used, Android can be more vulnerable to malware if users install apps from untrusted sources.


3. Performance Variability

Performance can vary depending on the device manufacturer and hardware specifications.


Android vs iOS

Android is often compared with iOS:

Feature Android iOS
Openness Open source Closed source
Customization High Limited
Devices Many manufacturers Apple devices only
App Store Google Play Store Apple App Store
Flexibility High Moderate

Popular Devices Using Android

Android is used by many major smartphone manufacturers, including:

  • Samsung

  • Xiaomi

  • OnePlus

  • Oppo

  • Vivo

These companies customize Android with their own user interfaces and features.


Use Cases of Android

Android is used in various domains:

1. Mobile Phones

The primary use of Android is in smartphones for communication, entertainment, and productivity.


2. Tablets

Android tablets are used for education, media consumption, and business tasks.


3. Smart TVs

Android TV provides streaming and entertainment capabilities.


4. Wearables

Android powers smartwatches and fitness trackers.


5. Automotive Systems

Android Auto is used in vehicles for navigation, media, and communication.


Future of Android

Android continues to evolve with advancements in:

  • Artificial intelligence integration

  • Foldable devices

  • Improved privacy and security features

  • Better performance optimization

With continuous innovation from Google, Android remains a dominant force in the mobile technology ecosystem.


Conclusion

Android is a powerful, flexible, and widely adopted operating system that has transformed the mobile industry. Its open-source nature, vast app ecosystem, and support for a wide range of devices make it a preferred choice for both users and developers.

From smartphones to smart TVs and wearable devices, Android plays a significant role in modern digital life. With ongoing improvements and global adoption, Android continues to shape the future of mobile computing.

Fresher Interview Questions

 

🧠 Basics of Android


1. What is Android?

Answer:
Android is an open-source mobile operating system developed by Google, mainly used for smartphones, tablets, and other devices.

πŸ‘‰ It is based on the Linux kernel and supports apps written in Java, Kotlin, and C++.


2. What are the main components of Android?

Answer:
Android apps are built using four main components:

  1. Activity – UI screen

  2. Service – Background tasks

  3. Broadcast Receiver – System-wide events

  4. Content Provider – Data sharing between apps


3. What is an Activity?

Answer:
An Activity represents a single screen with a user interface.

πŸ‘‰ Example:

  • Login screen

  • Home screen

Each activity has a lifecycle.


4. What is the Activity lifecycle?

Answer:
The lifecycle defines the states an activity goes through:

  • onCreate() → initialization

  • onStart() → visible

  • onResume() → user interaction

  • onPause() → partially visible

  • onStop() → not visible

  • onDestroy() → destroyed

πŸ‘‰ Helps manage resources efficiently.


5. What is a Fragment?

Answer:
A Fragment is a reusable portion of UI inside an activity.

πŸ‘‰ Used for:

  • Multi-pane layouts (tablet UI)

  • Reusability


βš™οΈ Intents & Navigation


6. What is an Intent?

Answer:
An Intent is used to navigate between activities or communicate between components.

Types:

  • Explicit Intent → target specific activity

  • Implicit Intent → system decides action

Example:

Intent intent = new Intent(MainActivity.this, SecondActivity.class);
startActivity(intent);

7. What is the difference between explicit and implicit intent?

Answer:

Explicit Intent Implicit Intent
Targets a specific component Uses system to find component
Used within app Used for external actions

8. What is an Intent Filter?

Answer:
Declares which intents a component can respond to.

πŸ‘‰ Defined in AndroidManifest.xml


🧩 UI Components


9. What are Views in Android?

Answer:
Views are UI elements like:

  • TextView

  • Button

  • EditText

  • ImageView


10. What is ViewGroup?

Answer:
A container that holds and arranges views.

Examples:

  • LinearLayout

  • RelativeLayout

  • ConstraintLayout


11. What is ConstraintLayout?

Answer:
A flexible layout that allows positioning views relative to each other.

πŸ‘‰ Preferred for modern UI design.


12. What is RecyclerView?

Answer:
Used to display large lists efficiently by recycling views.

πŸ‘‰ Better than ListView.


13. Difference between ListView and RecyclerView?

Answer:

ListView RecyclerView
Older Modern
Less flexible Highly flexible
No ViewHolder required Uses ViewHolder pattern

🧠 Data Storage


14. What are data storage options in Android?

Answer:

  • SharedPreferences → key-value storage

  • SQLite Database → structured data

  • Room Database → abstraction over SQLite

  • File storage


15. What is SharedPreferences?

Answer:
Used to store small amounts of data like:

  • User settings

  • Login status


16. What is SQLite?

Answer:
A lightweight relational database built into Android.


17. What is Room Database?

Answer:
An abstraction layer over SQLite that simplifies database operations.


βš™οΈ Threads & Background Tasks


18. Why are background threads needed?

Answer:
To avoid blocking the UI thread.

πŸ‘‰ Long tasks:

  • Network calls

  • Database operations


19. What is AsyncTask?

Answer:
A class used to perform background operations (now deprecated).


20. What are modern alternatives to AsyncTask?

Answer:

  • Kotlin Coroutines

  • Executor framework

  • WorkManager


🌐 Networking


21. How do Android apps make API calls?

Answer:
Using libraries like:

  • Retrofit

  • Volley

  • OkHttp


22. What is Retrofit?

Answer:
A type-safe HTTP client used for API communication.


πŸ” Permissions


23. What are Android permissions?

Answer:
Permissions allow apps to access system features like:

  • Camera

  • Location

  • Contacts


24. What is runtime permission?

Answer:
Permissions requested at runtime (Android 6.0+).


πŸ”„ Broadcast Receivers


25. What is a Broadcast Receiver?

Answer:
Used to receive system-wide events like:

  • Battery low

  • Network changes


⚑ Services


26. What is a Service?

Answer:
A component that runs in the background without UI.

Types:

  • Started Service

  • Bound Service


27. What is WorkManager?

Answer:
Used for deferrable background tasks that need guaranteed execution.


πŸ“¦ Android Manifest


28. What is AndroidManifest.xml?

Answer:
A configuration file that declares:

  • App components

  • Permissions

  • App metadata


🧠 Kotlin/Java Basics (for Android)


29. Why Kotlin is preferred over Java?

Answer:

  • Concise code

  • Null safety

  • Coroutines support

  • Interoperability with Java


30. What is null safety in Kotlin?

Answer:
Prevents null pointer exceptions using:

  • ?

  • !!

  • Safe calls ?.


πŸ“Š Scenario-Based Questions


31. How does an Android app start?

Answer:

  • Launcher activity is defined in manifest

  • System launches the app via intent


32. What happens when you rotate the device?

Answer:
Activity is destroyed and recreated by default.

πŸ‘‰ Data can be preserved using:

  • ViewModel

  • onSaveInstanceState()


33. What is configuration change?

Answer:
Changes like:

  • Screen rotation

  • Language change


34. How do you prevent data loss on rotation?

Answer:

  • ViewModel

  • onSaveInstanceState

  • Persistent storage


🎯 HR + Project Questions


35. Tell me about your Android project

πŸ‘‰ Explain:

  • App idea

  • Features

  • Tech used

  • Challenges faced

  • Your contribution


36. Why Android development?

πŸ‘‰ Example points:

  • Wide user base

  • Interest in mobile apps

  • Problem-solving


37. What are your strengths?

  • UI design understanding

  • Logical thinking

  • Debugging skills


πŸš€ Final Preparation Tips

βœ” Focus on:

  • Activity lifecycle

  • Intents

  • RecyclerView

  • Fragments

  • Basic networking

βœ” Practice:

  • Build simple apps:

    • Login app

    • To-do app

    • API-based app

βœ” Be ready to:

  • Explain your project in detail

  • Write simple Android code

  • Answer lifecycle-related questions


 

Experienced Interview Questions

 

πŸ”₯ 1. Explain Android application architecture

βœ… Answer:

Modern Android apps follow layered architecture:

Common layers:

  1. UI Layer

    • Activities / Fragments / Compose UI

    • ViewModel

  2. Domain Layer (optional)

    • Business logic

    • Use cases

  3. Data Layer

    • Repositories

    • Network (Retrofit)

    • Local DB (Room)


πŸ‘‰ Recommended pattern:

  • MVVM (Model-View-ViewModel)

  • Clean Architecture


πŸ”Ή 2. What is MVVM architecture in Android?

βœ… Answer:

MVVM separates UI from business logic.


Components:

  • Model → Data layer

  • View → UI (Activity/Fragment)

  • ViewModel → Manages UI state


Flow:

View → ViewModel → Repository → Data source


πŸ‘‰ Benefits:

  • Testable

  • Lifecycle-aware

  • Decoupled components


πŸ”Ή 3. What is the difference between Activity and Fragment?

βœ… Answer:

Feature Activity Fragment
Lifecycle Independent Dependent on Activity
Reusability Low High
UI Full screen Part of UI

πŸ‘‰ Fragments are used for modular UI design.


πŸ”Ή 4. Explain Android lifecycle in detail

βœ… Answer:

Activity lifecycle:

  1. onCreate()

  2. onStart()

  3. onResume()

  4. onPause()

  5. onStop()

  6. onDestroy()


πŸ‘‰ Important:

  • Save state in onSaveInstanceState()

  • Restore in onCreate()


πŸ”Ή 5. What is ViewModel and why is it used?

βœ… Answer:

ViewModel:

  • Stores UI-related data

  • Survives configuration changes (e.g., rotation)


class MyViewModel : ViewModel() {
    val data = MutableLiveData<String>()
}

πŸ‘‰ Benefits:

  • No memory leaks

  • Lifecycle-aware

  • Separates UI logic


πŸ”Ή 6. What is LiveData?

βœ… Answer:

Observable data holder that respects lifecycle.

val name = MutableLiveData<String>()

πŸ‘‰ Features:

  • Lifecycle-aware

  • Prevents memory leaks

  • Automatically updates UI


πŸ”Ή 7. LiveData vs StateFlow vs Flow

βœ… Answer:

Feature LiveData Flow StateFlow
Lifecycle aware Yes No No
Cold/Hot Hot Cold Hot
Backpressure No Yes Yes

πŸ‘‰ Modern apps prefer StateFlow + Flow (Kotlin Coroutines)


πŸ”Ή 8. What are Kotlin Coroutines?

βœ… Answer:

Lightweight threads for asynchronous programming.


viewModelScope.launch {
    val data = repository.getData()
}

πŸ‘‰ Benefits:

  • Non-blocking

  • Structured concurrency

  • Efficient threading


πŸ”Ή 9. What is Dispatchers in Coroutines?

βœ… Answer:

Controls thread execution:

Dispatcher Use
Main UI
IO Network/DB
Default CPU intensive

withContext(Dispatchers.IO) {
    // network call
}

πŸ”Ή 10. What is Retrofit?

βœ… Answer:

Type-safe HTTP client for Android.


interface ApiService {
    @GET("users")
    suspend fun getUsers(): List<User>
}

πŸ‘‰ Uses:

  • REST APIs

  • JSON parsing (Gson/Moshi)


πŸ”₯ Jetpack Components


πŸ”Ή 11. What is Room Database?

βœ… Answer:

SQLite abstraction layer.


@Entity
data class User(
    @PrimaryKey val id: Int,
    val name: String
)

πŸ‘‰ Benefits:

  • Compile-time verification

  • Type safety

  • Built-in DAO pattern


πŸ”Ή 12. What is DAO in Room?

βœ… Answer:

Data Access Object defines DB operations.

@Dao
interface UserDao {
    @Query("SELECT * FROM user")
    fun getUsers(): List<User>
}

πŸ”Ή 13. What is Paging Library?

βœ… Answer:

Efficiently loads large datasets in chunks.


πŸ‘‰ Used in:

  • Infinite scrolling lists

  • Pagination APIs


πŸ”Ή 14. What is WorkManager?

βœ… Answer:

Handles background tasks reliably.


πŸ‘‰ Features:

  • Survives app restarts

  • Works with constraints (network, battery)


πŸ”Ή 15. What is Hilt (Dependency Injection)?

βœ… Answer:

Dependency injection library by Google.


@HiltAndroidApp
class MyApp : Application()

πŸ‘‰ Benefits:

  • Reduces boilerplate

  • Manages dependencies

  • Improves testability


πŸ”₯ Performance & Optimization


πŸ”Ή 16. How do you optimize Android app performance?

βœ… Answer:

  • Avoid memory leaks

  • Use lazy loading

  • Optimize layouts (ConstraintLayout)

  • Use RecyclerView efficiently

  • Avoid heavy work on main thread

  • Use caching


πŸ”Ή 17. What causes ANR (Application Not Responding)?

βœ… Answer:

Occurs when main thread is blocked for too long.


πŸ‘‰ Causes:

  • Long network calls on main thread

  • Heavy computations

  • Deadlocks


πŸ‘‰ Fix:

  • Move work to background threads


πŸ”Ή 18. What is memory leak in Android?

βœ… Answer:

Objects not garbage collected due to lingering references.


πŸ‘‰ Common causes:

  • Static references to Activity

  • Anonymous inner classes

  • Improper context usage


πŸ‘‰ Tools:

  • LeakCanary

  • Android Profiler


πŸ”Ή 19. What is RecyclerView optimization?

βœ… Answer:

  • Use ViewHolder pattern

  • Avoid unnecessary binding

  • Use DiffUtil

  • Enable stable IDs


πŸ”Ή 20. What is DiffUtil?

βœ… Answer:

Efficiently updates RecyclerView by calculating differences.


DiffUtil.calculateDiff(...)

πŸ”₯ Architecture & Design Questions


πŸ”Ή 21. How do you design a scalable Android app?

βœ… Answer:

  • MVVM + Clean Architecture

  • Use repositories

  • Modularize app

  • Dependency injection (Hilt)

  • Use single source of truth

  • Use Flow/StateFlow


πŸ”Ή 22. How do you handle configuration changes?

βœ… Answer:

  • ViewModel survives rotation

  • Save UI state using SavedStateHandle

  • Avoid recreating data


πŸ”Ή 23. How do you handle offline-first apps?

βœ… Answer:

  • Local DB (Room)

  • Cache API responses

  • Sync strategy

  • WorkManager for background sync


πŸ”Ή 24. How do you handle API errors?

βœ… Answer:

  • Use sealed classes for response states

sealed class Result {
    object Success : Result()
    object Error : Result()
    object Loading : Result()
}

πŸ”Ή 25. How do you secure Android apps?

βœ… Answer:

  • Use HTTPS

  • Encrypt sensitive data (EncryptedSharedPreferences)

  • Avoid hardcoding secrets

  • Use ProGuard/R8 obfuscation

  • Root detection (optional)


πŸ”₯ Scenario-Based Questions


πŸ”Ή Q26: App is slow during scrolling—why?

βœ… Answer:

  • Heavy UI binding

  • Inefficient RecyclerView usage

  • Large images not optimized

  • Main thread blocking


πŸ”Ή Q27: How would you debug crashes?

βœ… Answer:

  • Logcat analysis

  • Crashlytics

  • Stack trace inspection

  • Reproduce issue


πŸ”Ή Q28: How do you reduce APK size?

βœ… Answer:

  • ProGuard/R8

  • Remove unused resources

  • Use vector drawables

  • Split APKs / App bundles


πŸ”Ή Q29: How do you handle multi-module projects?

βœ… Answer:

  • Feature modules

  • Core modules

  • Dependency isolation

  • Gradle modularization


πŸ”Ή Q30: How do you implement real-time features?

βœ… Answer:

  • WebSockets

  • Firebase Realtime Database

  • Polling APIs

  • Push notifications


πŸ”₯ Advanced Topics (Senior Level)


πŸ”Ή 31. What is cold vs hot flow?

βœ… Answer:

Type Behavior
Cold Flow Starts on collection
Hot Flow Emits continuously

πŸ”Ή 32. What is StateFlow vs SharedFlow?

βœ… Answer:

Feature StateFlow SharedFlow
Holds state Yes No
Replay 1 Configurable
Use case UI state Events

πŸ”Ή 33. What is structured concurrency?

βœ… Answer:

Coroutines are bound to lifecycle scopes.


πŸ‘‰ Prevents:

  • Leaked coroutines

  • Uncontrolled background tasks


πŸ”Ή 34. What is ProGuard/R8?

βœ… Answer:

  • Code shrinking

  • Obfuscation

  • Optimization


πŸ”Ή 35. What is Jetpack Compose?

βœ… Answer:

Modern UI toolkit for declarative UI.


πŸ‘‰ Benefits:

  • Less boilerplate

  • Reactive UI

  • State-driven rendering


πŸ”₯ Final Interview Tips 

Interviewers expect:

  • Strong architecture understanding

  • Threading & concurrency knowledge

  • Real-world debugging experience

  • Performance optimization skills

  • Clean code practices