Android

Android

Top Interview Questions

About Android

 

Android: A Comprehensive Overview

Android is one of the most widely used operating systems in the world, powering billions of devices globally. Developed by Android Inc., which was later acquired by Google in 2005, Android has become the backbone of mobile computing and has expanded into other devices such as tablets, smart TVs, wearables, and even automobiles. Its open-source nature, coupled with the flexibility it offers developers, has played a significant role in its massive adoption.

History and Evolution

Android’s history begins in 2003 when it was founded by Andy Rubin, Rich Miner, Nick Sears, and Chris White with the original vision of creating a smart camera operating system. However, the focus shifted toward mobile phones, recognizing the vast potential of the smartphone market. Google’s acquisition of Android in 2005 enabled the operating system to grow rapidly, leveraging Google’s resources and ecosystem.

The first commercial Android device, the HTC Dream (also known as the T-Mobile G1), was launched in 2008. Since then, Android has undergone continuous evolution, with each version introducing new features, improvements, and performance optimizations. Android versions are often named after desserts or sweet treats, starting with Cupcake, Donut, Éclair, and progressing through versions like Lollipop, Marshmallow, Nougat, Oreo, Pie, and most recently, Android 13 and 14, which focus on privacy, performance, and user experience enhancements.

Architecture of Android

Android’s architecture is layered, allowing developers to build robust and scalable applications. At a high level, Android consists of four major layers:

  1. Linux Kernel: At the core, Android runs on a modified Linux kernel. The kernel handles fundamental tasks such as memory management, process management, device drivers, and networking. It provides a stable foundation for the Android system and ensures security and resource management.

  2. Hardware Abstraction Layer (HAL): The HAL acts as an intermediary between the hardware and the higher-level system components. It allows Android to communicate with different hardware components such as cameras, sensors, GPS, and audio without requiring developers to write device-specific code.

  3. Android Runtime (ART) and Libraries: ART replaced the older Dalvik Virtual Machine in Android 5.0 Lollipop, providing better performance and memory efficiency. ART executes Android applications written in Java or Kotlin. Android also includes a set of native C/C++ libraries that provide functionalities such as graphics rendering (OpenGL), database management (SQLite), and media playback.

  4. Application Framework and Applications: The application framework provides APIs that developers use to build apps, including access to services like location, telephony, notifications, and UI components. On top of this framework sits the application layer, where apps interact with the user.

Programming Languages and Development

Android app development primarily uses Java and Kotlin. Java was the original language for Android, offering a mature and robust platform for application development. Kotlin, officially supported by Google since 2017, is now the preferred language due to its concise syntax, null-safety, and modern features, which reduce common programming errors.

Developers use Android Studio, the official Integrated Development Environment (IDE), to create apps. Android Studio provides a rich set of tools, including code editors, debuggers, emulators, and performance analyzers. It also supports Gradle for build automation, making the development and deployment process streamlined.

Android Application Components

An Android application is composed of several components:

  1. Activities: These are screens that users interact with. Each activity is responsible for a single UI and handles user inputs.

  2. Services: Services run in the background without a user interface, performing tasks such as fetching data, playing music, or managing notifications.

  3. Broadcast Receivers: These components respond to system-wide broadcast messages, such as battery low warnings or network connectivity changes.

  4. Content Providers: Content providers manage shared app data, allowing data to be accessed and modified by multiple applications.

These components communicate via Intents, which are messages that facilitate inter-component communication and data transfer.

Features of Android

Android provides numerous features that contribute to its popularity:

  • Open Source: Android’s open-source nature allows device manufacturers and developers to modify and customize the operating system according to their needs.

  • Multitasking: Android supports efficient multitasking, enabling users to run multiple apps simultaneously.

  • Customization: Users can customize home screens, widgets, themes, and notifications extensively.

  • Google Integration: Android devices benefit from deep integration with Google services like Gmail, Google Maps, Google Drive, and the Google Play Store.

  • Connectivity: Android supports various connectivity options including Wi-Fi, Bluetooth, NFC, and mobile data.

  • Security: Android offers robust security features such as app sandboxing, biometric authentication, and regular security updates.

  • Notifications and Widgets: Android allows rich notifications and interactive widgets, improving user engagement.

Android Ecosystem

The Android ecosystem is vast. The Google Play Store is the primary marketplace for Android apps, hosting millions of apps across categories like social media, gaming, productivity, and finance. Besides smartphones and tablets, Android powers wearables through Wear OS, smart TVs via Android TV, automotive systems via Android Automotive, and even IoT devices through Android Things.

Android Security

Security is a critical aspect of Android. Google implements several measures:

  • App Sandbox: Each app runs in its own sandbox, restricting access to system resources and other apps.

  • Permission Model: Apps must request explicit permissions to access sensitive data like location, camera, or contacts.

  • Google Play Protect: This scans apps for malware and warns users of potential risks.

  • Regular Security Patches: Google releases monthly security updates to patch vulnerabilities.

Advantages and Challenges

Advantages:

  1. Wide Adoption: Android dominates the global smartphone market, making it an attractive platform for developers.

  2. Flexibility: Its open-source nature allows manufacturers and developers to innovate and differentiate their products.

  3. Large Developer Community: A massive community provides support, tutorials, and open-source libraries.

  4. Cost-Effective: Most Android devices are available at various price points, making the platform accessible.

Challenges:

  1. Fragmentation: Due to the diversity of devices and manufacturers, Android faces fragmentation, leading to inconsistencies in app performance.

  2. Security Risks: Open-source flexibility sometimes exposes devices to malware or unauthorized modifications.

  3. Complex Testing: The wide variety of screen sizes, resolutions, and hardware specifications requires thorough testing.

Future of Android

Android continues to evolve, with Google focusing on improving user experience, privacy, and integration across devices. Technologies like AI, machine learning, augmented reality, and 5G are becoming more integrated into Android apps. With Android’s continuous updates and support for innovative hardware, it is poised to maintain its leadership in mobile computing for years to come.

 

Fresher Interview Questions

 

1. What is Android?

Answer:
Android is an open-source, Linux-based operating system developed by Google, primarily used for mobile devices like smartphones and tablets. It provides a rich application framework for developers to create innovative apps and runs on the Dalvik/ART virtual machine.


2. What are the key features of Android?

Answer:

  • Open-source: Android is freely available to developers.

  • Linux Kernel-based: Offers security and memory management.

  • Rich UI: Supports XML-based layouts and multiple UI components.

  • Multitasking: Allows running multiple apps simultaneously.

  • Connectivity: Supports Bluetooth, Wi-Fi, NFC, and more.

  • App Development: Provides Java/Kotlin SDK for app creation.


3. What is the Android architecture?

Answer:
Android has a four-layer architecture:

  1. Linux Kernel: Low-level hardware interface, security, memory management, and drivers.

  2. Libraries & Android Runtime:

    • Libraries: SQLite, WebKit, OpenGL, Media framework.

    • Android Runtime: Includes Dalvik/ART VM and core Java libraries.

  3. Application Framework: APIs for building apps (Activity Manager, Resource Manager, Content Providers).

  4. Applications: User-installed apps (Gmail, WhatsApp) and system apps.


4. What are Activities in Android?

Answer:

  • An Activity represents a single screen in an app.

  • It interacts with users and controls UI components like buttons, text fields, etc.

  • Lifecycle methods: onCreate(), onStart(), onResume(), onPause(), onStop(), onDestroy().


5. What is the difference between Activity and Fragment?

Activity Fragment
Represents a full-screen UI. Represents a portion of UI.
Cannot exist without an Activity. Must exist inside an Activity.
Has its own lifecycle. Has its own lifecycle but depends on the parent Activity.

6. What is an Intent in Android?

Answer:
An Intent is a messaging object to request actions from other app components.

  • Types:

    • Explicit Intent: Targets a specific component (Activity/Service).

    • Implicit Intent: Declares general action to be handled by any suitable app.
      Example: Open a URL using an Intent.


7. What are Services in Android?

Answer:
A Service is a component that performs background operations without a user interface.

  • Types:

    • Started Service: Runs until stopped (startService()).

    • Bound Service: Runs as long as another app binds to it (bindService()).


8. What is a Broadcast Receiver?

Answer:

  • A component that responds to system-wide broadcast messages, like battery low or Wi-Fi connectivity changes.

  • Registered in AndroidManifest.xml or dynamically via code.
    Example: Listen for incoming SMS or network changes.


9. What is a Content Provider?

Answer:

  • Content Providers allow apps to share data between them in a secure manner.

  • Uses URI (Uniform Resource Identifier) to access data.

  • Example: Accessing contacts, media files, or calendar events.


10. Explain AndroidManifest.xml

Answer:

  • A configuration file that defines app components: Activities, Services, Broadcast Receivers, permissions, and app metadata.

  • Essential for app execution as Android uses it to know components and required permissions.


11. What are the storage options in Android?

Answer:

  1. Internal Storage: Private to the app, secure.

  2. External Storage: Shared, less secure, requires permission.

  3. SharedPreferences: Stores key-value pairs (like settings).

  4. SQLite Database: Local structured database.

  5. Room Database: Modern SQLite wrapper for structured data storage.


12. What is the difference between Serializable and Parcelable?

Serializable Parcelable
Standard Java interface. Android-specific interface.
Slower, uses reflection. Faster, manual implementation.
Easy to implement. Requires more code.
Can be used outside Android. Only for Android inter-component communication.

13. Explain Android Activity Lifecycle

Answer:

  1. onCreate(): Initialize components.

  2. onStart(): Activity becomes visible.

  3. onResume(): Activity starts interacting with the user.

  4. onPause(): Activity partially hidden, save data.

  5. onStop(): Activity no longer visible.

  6. onDestroy(): Cleanup before destruction.

  7. onRestart(): Activity restarting after being stopped.


14. What are Threads and AsyncTask in Android?

  • Threads: Perform long-running tasks to avoid blocking UI.

  • AsyncTask (Deprecated): Simplified way to run tasks in background and update UI.

    • Methods: doInBackground(), onPreExecute(), onPostExecute(), onProgressUpdate().


15. What is the difference between Service and Thread?

Service Thread
Runs in background and can run indefinitely. Runs in background but bound to the app’s process.
Does not run on UI thread by default. Must manage UI updates with Handler/Looper.
Used for long-running operations like downloading. Used for small background tasks.

16. What is Gradle in Android?

Answer:
Gradle is a build automation tool used in Android Studio. It handles dependencies, builds, and packaging.

  • Build Types: debug, release.

  • Dependency Management: External libraries are added in build.gradle.


17. What are the common Android components?

Answer:

  1. Activities – Screens

  2. Fragments – Reusable UI parts

  3. Services – Background tasks

  4. Broadcast Receivers – Event handling

  5. Content Providers – Data sharing

  6. Intents – Communication between components


18. What is the difference between onSaveInstanceState() and onRestoreInstanceState()?

  • onSaveInstanceState(): Called before an Activity may be destroyed to save UI state.

  • onRestoreInstanceState(): Called after onStart() to restore the saved state.


19. What are PendingIntents?

Answer:

  • PendingIntent allows an app to pass a future intent to another app or system service.

  • Commonly used with Notifications, AlarmManager, or Widgets.


20. What is Android Jetpack?

Answer:

  • A set of libraries, tools, and guidelines to make Android app development faster and easier.

  • Includes:

    • Architecture Components: LiveData, ViewModel, Room, WorkManager.

    • UI Components: Navigation, Paging, MotionLayout.

    • Behavior Components: Notifications, Permissions.


21. How do you prevent memory leaks in Android?

Answer:

  • Avoid long-lived references to Context.

  • Use WeakReference for large objects.

  • Unregister listeners in onDestroy() or onStop().

  • Use LeakCanary tool for detection.


22. Difference between dp, sp, and px

Unit Purpose
px Pixels, absolute screen size.
dp Density-independent pixels, adjusts to screen density.
sp Scaled pixels, used for fonts, respects user’s font size settings.

23. What is an ANR in Android?

Answer:

  • Application Not Responding (ANR) occurs when an app blocks the main thread for too long (usually >5 seconds).

  • Avoid by using background threads for heavy tasks.


24. How do you optimize Android app performance?

Answer:

  • Use RecyclerView instead of ListView.

  • Avoid memory leaks.

  • Minimize layout hierarchies.

  • Use Glide/Picasso for image loading.

  • Lazy loading and caching of data.


25. Difference between Service, IntentService, and JobIntentService

Service IntentService JobIntentService
Runs on main thread. Runs on a background thread. Runs on background thread, supports API 26+ restrictions.
Needs manual thread management. Stops automatically when work is done. Handles background work efficiently with system constraints.

26. What is the difference between Java and Kotlin in Android?

Answer:
Kotlin is a modern programming language officially supported by Google for Android development.

Java Kotlin
Verbose code Less boilerplate
NullPointerException common Null safety built-in
Slower development Faster development
No extension functions Supports extension functions
More lines of code Concise syntax

27. What is Context in Android?

Answer:
Context is a reference to the current state of the application. It allows access to resources, databases, preferences, and system services.

Types of Context:

  1. Application Context – Lifetime of the app

  2. Activity Context – Lifetime of an activity


28. Difference between Application Context and Activity Context

Application Context Activity Context
Lives throughout app lifecycle Lives until activity is destroyed
Used for global tasks Used for UI-related tasks
Cannot inflate UI Can inflate UI

29. What is RecyclerView?

Answer:
RecyclerView is an advanced version of ListView used to display large datasets efficiently.

Key components:

  • Adapter

  • ViewHolder

  • LayoutManager

Advantages:

  • Better performance

  • View recycling

  • Supports animations and different layouts


30. Difference between ListView and RecyclerView

ListView RecyclerView
Less flexible Highly flexible
No ViewHolder pattern by default Mandatory ViewHolder
Slower Faster
Limited animations Built-in animations

31. What is ViewModel in Android?

Answer:
ViewModel is part of Android Jetpack Architecture Components.
It stores and manages UI-related data in a lifecycle-conscious way.

Benefits:

  • Survives configuration changes

  • Prevents data loss on screen rotation

  • Separates UI logic from business logic


32. What is LiveData?

Answer:
LiveData is an observable data holder that is lifecycle-aware.

Advantages:

  • Automatically updates UI

  • Prevents memory leaks

  • Works well with ViewModel


33. What is MVVM architecture?

Answer:
MVVM stands for:

  • Model – Data layer

  • View – UI (Activity/Fragment)

  • ViewModel – Business logic

Advantages:

  • Clean code

  • Easy testing

  • Better separation of concerns


34. What is Data Binding?

Answer:
Data Binding allows binding UI components directly to data sources.

Benefits:

  • Reduces boilerplate code

  • Eliminates findViewById()

  • Better code readability


35. Difference between findViewById and ViewBinding

findViewById ViewBinding
Runtime errors possible Compile-time safety
More boilerplate Less code
Slower Faster

36. What is Room Database?

Answer:
Room is an ORM (Object Relational Mapping) library built on SQLite.

Components:

  1. Entity

  2. DAO

  3. Database

Advantages:

  • Compile-time query validation

  • Easy database access

  • Works with LiveData


37. What is REST API?

Answer:
REST API allows Android apps to communicate with servers using HTTP methods:

  • GET

  • POST

  • PUT

  • DELETE


38. What is Retrofit?

Answer:
Retrofit is a type-safe HTTP client for Android.

Advantages:

  • Easy API calls

  • Supports JSON parsing

  • Integrates with Gson and Moshi


39. Difference between Retrofit and Volley

Retrofit Volley
Used for REST APIs Used for small network calls
Better for large data Faster for small data
Supports RxJava No RxJava support

40. What is JSON?

Answer:
JSON (JavaScript Object Notation) is a lightweight data-interchange format used in APIs.


41. What is Permission in Android?

Answer:
Permissions allow apps to access restricted system features.

Types:

  • Normal permissions

  • Dangerous permissions (Camera, Location)


42. What are Runtime Permissions?

Answer:
From Android 6.0 (API 23), dangerous permissions must be requested at runtime.


43. What is Toast and Snackbar?

Toast Snackbar
Small popup message Interactive message
No user action Supports actions
Limited customization More customizable

44. What is a Dialog in Android?

Answer:
Dialog is a small window that prompts users to make a decision or enter information.


45. What is ConstraintLayout?

Answer:
ConstraintLayout is a flexible layout that allows positioning UI elements relative to others.

Advantages:

  • Flat view hierarchy

  • Better performance

  • Responsive design


46. What is APK?

Answer:
APK (Android Package Kit) is the file format used to distribute Android apps.


47. Difference between APK and AAB

APK AAB
Direct install Google Play optimized
Larger size Smaller downloads
Manual updates Dynamic delivery

48. What is ProGuard?

Answer:
ProGuard shrinks, optimizes, and obfuscates code to protect it.


49. What is Firebase?

Answer:
Firebase is a backend platform by Google.

Services:

  • Authentication

  • Firestore

  • Realtime Database

  • Cloud Messaging

  • Crashlytics


50. What is Push Notification?

Answer:
Push notifications are messages sent from servers to devices using Firebase Cloud Messaging (FCM).


51. What is WorkManager?

Answer:
WorkManager handles background tasks reliably, even after app restarts.


52. Difference between AsyncTask and WorkManager

AsyncTask WorkManager
Deprecated Recommended
Short tasks Long, deferrable tasks
Not lifecycle aware Lifecycle aware

53. What is SharedPreferences?

Answer:
Stores small key-value data like login status or settings.


54. What is Navigation Component?

Answer:
Simplifies navigation between fragments and activities.


55. What is Deep Linking?

Answer:
Allows users to open a specific screen using a URL.


56. What is an Emulator?

Answer:
Emulator simulates an Android device on a computer for testing.


57. Difference between Emulator and Real Device

Emulator Real Device
Slower Faster
No hardware limitations Real-world testing
Limited sensors Actual sensors

58. What is Debugging in Android?

Answer:
Debugging is the process of finding and fixing errors using Logcat and breakpoints.


59. What is Logcat?

Answer:
Logcat displays system logs and app logs.


60. What is the Android SDK?

Answer:
SDK (Software Development Kit) provides tools, APIs, and libraries for Android app development.

Experienced Interview Questions

 

1. Explain Android app architecture you have used in projects

Answer:
In real projects, MVVM with Clean Architecture is commonly used.

Layers:

  • Presentation – Activity/Fragment + ViewModel

  • Domain – Business logic, UseCases

  • Data – Repository, Remote & Local data sources

Benefits:

  • Separation of concerns

  • Easy testing

  • Lifecycle awareness

  • Scalability


2. What is the difference between MVVM and MVP?

MVVM MVP
ViewModel survives config changes Presenter does not
LiveData observes UI Manual callbacks
Less boilerplate More boilerplate
Recommended by Google Older approach

3. How does ViewModel survive configuration changes?

Answer:
ViewModel is stored in the ViewModelStore, which survives configuration changes like screen rotation.
When Activity is recreated, the same ViewModel instance is reused.


4. How do you handle configuration changes?

Answer:

  • Use ViewModel

  • Store UI state using SavedStateHandle

  • Avoid keeping references to Context

  • Use onSaveInstanceState() for temporary UI data


5. What is ANR and how do you avoid it?

Answer:
ANR occurs when the main thread is blocked for more than 5 seconds.

Avoid ANR by:

  • Moving heavy tasks to background threads

  • Using WorkManager or Coroutines

  • Optimizing database queries

  • Avoiding long operations in lifecycle methods


6. Explain Coroutines in Android

Answer:
Coroutines simplify async programming.

Key elements:

  • suspend functions

  • Dispatchers.Main, IO, Default

  • CoroutineScope

Advantages:

  • Cleaner code

  • Structured concurrency

  • Lifecycle aware using viewModelScope


7. Difference between Coroutines and RxJava

Coroutines RxJava
Simpler Steeper learning curve
Lightweight Heavy
Built-in Kotlin support External dependency
Recommended now Still used in legacy apps

8. What is WorkManager and when do you use it?

Answer:
WorkManager is used for deferrable background tasks that must run even if the app is killed.

Use cases:

  • Upload logs

  • Sync data

  • Periodic background tasks


9. Difference between WorkManager, JobScheduler, and AlarmManager

WorkManager JobScheduler AlarmManager
Guaranteed execution System-managed Time-based
Backward compatible API 21+ Less reliable
Recommended Advanced use Rarely used

10. How do you optimize RecyclerView performance?

Answer:

  • Use ListAdapter with DiffUtil

  • Enable view recycling

  • Use stable IDs

  • Avoid deep layout nesting

  • Use paging for large datasets


11. What is DiffUtil?

Answer:
DiffUtil calculates differences between old and new lists and updates only changed items, improving RecyclerView performance.


12. Explain Paging 3 library

Answer:
Paging 3 loads data in chunks.

Benefits:

  • Reduced memory usage

  • Handles large datasets

  • Integrates with Room & Retrofit


13. How do you handle API calls in Android?

Answer:

  • Use Retrofit

  • Handle responses using sealed classes

  • Use Coroutines

  • Implement retry & error handling

  • Cache using Room


14. How do you handle API errors globally?

Answer:

  • Interceptors in OkHttp

  • Common error wrapper

  • Centralized error handling in Repository

  • Show meaningful UI states


15. What is Repository pattern?

Answer:
Repository acts as a single source of truth, managing data from network and database.


16. How do you secure sensitive data in Android?

Answer:

  • EncryptedSharedPreferences

  • Keystore system

  • Avoid hardcoding secrets

  • Enable ProGuard/R8

  • Use HTTPS with SSL pinning


17. What is SSL Pinning?

Answer:
SSL pinning restricts app communication to trusted certificates, preventing MITM attacks.


18. How do you prevent memory leaks?

Answer:

  • Avoid static references to Context

  • Use WeakReference

  • Clear bindings in onDestroyView()

  • Use LeakCanary


19. Difference between onCreate() and onStart()

onCreate() onStart()
Initialize UI Activity becomes visible
Called once Can be called multiple times

20. What is SavedStateHandle?

Answer:
It saves UI-related data that survives process death.


21. How do you manage background location updates?

Answer:

  • Use Foreground Service

  • Request background location permission

  • Follow Android 10+ restrictions


22. What is Jetpack Compose?

Answer:
Compose is a declarative UI toolkit replacing XML.

Advantages:

  • Less boilerplate

  • Reactive UI

  • Faster UI development


23. XML vs Jetpack Compose

XML Compose
Imperative Declarative
More boilerplate Less code
Slower UI updates Reactive UI

24. How do you handle deep links?

Answer:

  • Configure intent filters

  • Use Navigation Component

  • Handle parameters safely


25. How do you handle multi-module projects?

Answer:

  • Separate features into modules

  • Faster build times

  • Better code isolation


26. What is Dependency Injection?

Answer:
DI provides dependencies from outside rather than creating them internally.


27. Dagger vs Hilt

Dagger Hilt
Boilerplate heavy Simplified
Manual setup Auto-generated
Complex Easy

28. How do you test Android applications?

Answer:

  • Unit tests (JUnit, Mockito)

  • UI tests (Espresso)

  • Integration tests


29. How do you handle offline support?

Answer:

  • Cache data using Room

  • Sync when network available

  • Show cached data


30. What is ProGuard / R8?

Answer:

  • Code shrinking

  • Obfuscation

  • Optimization


31. How do you manage multiple build variants?

Answer:

  • Use productFlavors

  • Separate environments (dev, staging, prod)


32. What is AAB and why is it preferred?

Answer:
Android App Bundle reduces app size and optimizes delivery.


33. How do you improve app startup time?

Answer:

  • Lazy initialization

  • Remove heavy logic from onCreate()

  • Use App Startup library


34. What is StrictMode?

Answer:
StrictMode detects accidental disk/network access on main thread.


35. Explain your biggest Android challenge

Answer:
Handling performance issues, memory leaks, and background execution restrictions while maintaining smooth UX.


36. How do you handle process death in Android?

Answer:
Process death happens when the system kills the app to reclaim memory.

Handling strategies:

  • Use SavedStateHandle in ViewModel

  • Persist critical data in Room

  • Avoid relying only on ViewModel

  • Restore state in onCreate()


37. What is the difference between configuration change and process death?

Configuration Change Process Death
Activity recreated App process killed
ViewModel survives ViewModel destroyed
Predictable Unpredictable

38. Explain foreground service and when to use it

Answer:
A foreground service performs user-visible tasks with a persistent notification.

Use cases:

  • Location tracking

  • Music playback

  • File upload/download


39. How does Android handle background execution limits (Android 8+)?

Answer:

  • Background services restricted

  • Use WorkManager

  • Use Foreground Services

  • JobScheduler for deferred work


40. What is ANR watchdog and how do you debug ANRs?

Answer:

  • Use Logcat

  • Analyze ANR traces

  • Use StrictMode

  • Avoid blocking main thread


41. How do you handle large images efficiently?

Answer:

  • Use Glide or Coil

  • Resize images

  • Avoid loading full-size bitmaps

  • Use caching


42. What is Bitmap pooling?

Answer:
Bitmap pooling reuses bitmap memory to reduce GC overhead and improve performance.


43. How do you reduce APK size?

Answer:

  • Use AAB

  • Enable R8

  • Remove unused resources

  • Use WebP images


44. Explain multi-threading in Android

Answer:

  • Main thread for UI

  • Background threads for heavy work

  • Use Coroutines / Executors


45. What is Looper and Handler?

Answer:

  • Looper manages message queue

  • Handler posts tasks to Looper


46. How do you schedule periodic background tasks?

Answer:

  • WorkManager with PeriodicWorkRequest

  • Avoid AlarmManager unless necessary


47. What is Jetpack Startup library?

Answer:
Optimizes app startup by initializing components lazily.


48. Explain deep linking vs app linking

Deep Linking App Linking
Works with any app Verified domain
Can be intercepted Secure

49. How do you manage feature toggles?

Answer:

  • Remote Config (Firebase)

  • Build variants

  • Server-side flags


50. How do you handle network connectivity changes?

Answer:

  • Use ConnectivityManager

  • Observe network state

  • Handle offline scenarios gracefully


51. How do you implement pagination manually?

Answer:

  • Track page number

  • Load on scroll

  • Handle loading states

  • Cache data


52. Explain Clean Architecture in Android

Answer:
Clean Architecture separates concerns into independent layers with clear dependency rules.


53. What is Single Source of Truth (SSOT)?

Answer:
One authoritative data source ensures consistency and reliability.


54. How do you handle exceptions in Coroutines?

Answer:

  • try-catch

  • CoroutineExceptionHandler

  • Structured concurrency


55. Difference between launch and async

launch async
Fire-and-forget Returns result
No return value Returns Deferred

56. What is Flow in Kotlin?

Answer:
Flow is a cold asynchronous data stream.


57. Flow vs LiveData

Flow LiveData
Kotlin native Android-specific
Supports operators Limited
Cold stream Hot stream

58. How do you collect Flow safely in UI?

Answer:

  • Use repeatOnLifecycle

  • Avoid memory leaks

  • Cancel automatically


59. What is StateFlow and SharedFlow?

Answer:

  • StateFlow holds UI state

  • SharedFlow emits events


60. How do you handle one-time events?

Answer:

  • SharedFlow

  • Event wrapper

  • Channel


61. How do you handle app crashes in production?

Answer:

  • Firebase Crashlytics

  • Log meaningful exceptions

  • Monitor crash trends


62. How do you secure API keys?

Answer:

  • Do not hardcode

  • Use backend token exchange

  • Use Keystore


63. Explain ContentProvider use cases

Answer:

  • Sharing data

  • App widgets

  • Inter-app communication


64. How do you handle app updates without breaking users?

Answer:

  • Backward compatibility

  • Database migrations

  • Feature flags


65. What is database migration in Room?

Answer:
Handles schema changes without data loss.


66. How do you debug memory leaks?

Answer:

  • LeakCanary

  • Android Profiler

  • Heap dump analysis


67. How do you handle push notifications effectively?

Answer:

  • Use FCM

  • Handle background & foreground

  • Manage notification channels


68. What is scoped storage?

Answer:
Limits file access to improve security (Android 10+).


69. How do you handle file downloads in Android?

Answer:

  • DownloadManager

  • Foreground service for large files


70. How do you prepare for Play Store compliance?

Answer:

  • Follow permission guidelines

  • Use privacy policy

  • Data safety declaration