Your Cheat Sheet For Android Interview - Android Interview Questions and Answers
Android Interview Questions and Answers
Android Interview Questions and Answers - Your Cheat Sheet For Android Interview
Prepared and maintained by the Founder of Outcome School: Amit Shekhar
About me
Hi, I am Amit Shekhar, Founder @ Outcome School β’ IIT 2010-14 β’ I have taught and mentored many developers, and their efforts landed them high-paying tech jobs, helped many tech companies in solving their unique problems, and created many open-source libraries being used by top companies. I am passionate about sharing knowledge through open-source, blogs, and videos.
You can connect with me on:
Live session on "Android Developer Interview Preparation for Product-based Companies"
I conducted a live session on "Android Developer Interview Preparation for Product-based Companies"
Interacted with over 500 Android Developers.
Guided, motivated, and inspired them to aim higher and achieve more.
Recording Link: https://www.youtube.com/watch?v=Yby0AA7ZSUE
Document Link: https://docs.google.com/document/d/14UdD7Gd1j3no583ALx2t2Ggt3G_CECYhenLE-m-bkzA/edit?usp=sharing
Contents - Android Interview Questions
- Android Interview Questions and Answers Playlist
- Kotlin Coroutines
- Kotlin Flow API
- Kotlin
- Android
- Android Libraries
- Android Architecture
- Design Pattern
- Android System Design and check Android System Design Interviews
- Android Unit Testing
- Android Tools And Technologies
- Jetpack Compose
- Java
- Other Topics
- Data Structures and Algorithms
- For Android Machine Coding Round Interview, Check: Android Machine Coding Round Interview
I teach at Outcome School
Join Outcome School and get a high-paying tech job: Outcome SchoolFast-Track Android Interview Preparation: Join Outcome School Android Program
Android Interview Questions and Answers Playlist
Watch this video on "Android Developer Interview Preparation for Product-Based Companies": Android Developer Interview Preparation for Product-Based Companies
- Question: Android Push Notification Flow using FCM
- Question: What is an inline function in Kotlin?
- Question: What is the advantage of using const in Kotlin?
- Question: What is a reified keyword in Kotlin?
- Question: Suspending vs Blocking in Kotlin Coroutines
- Question: Retrofit vs OkHttp
- Question: Launch vs Async in Kotlin Coroutines
- Question: internal visibility modifier in Kotlin
- Question: open keyword in Kotlin
- Question: lateinit vs lazy in Kotlin
- Question: What is Multidex in Android?
- Question: How does the Android Push Notification system work?
- Question: How does the Kotlin Multiplatform work?
- Question: What is a ViewModel and how is it useful?
- Question: Is it possible to force the Garbage Collection in Android?
- Question: What is a JvmStatic Annotation in Kotlin?
- Question: init block in Kotlin
- Question: JvmField Annotation in Kotlin
- Question: singleTask launchMode in Android
- Question: Difference between == and === in Kotlin
- Question: JvmOverloads Annotation in Kotlin
- Question: Why is it recommended to use only the default constructor to create a Fragment?
- Question: Why do we need to call setContentView() in onCreate() of Activity class?
- Question: When only onDestroy is called for an activity without onPause() and onStop()?
Fast-Track Android Interview Preparation: Join Outcome School Android Program
Kotlin Coroutines
Topics you should know in Kotlin Coroutines for Android Interview:
- coroutines
- suspend
- launch, async-await, withContext
- dispatchers
- scope, context, job
- lifecycleScope, viewModelScope, GlobalScope
- suspendCoroutine, suspendCancellableCoroutine
- coroutineScope, supervisorScope
- runBlocking
- Exception Handling
- Master Kotlin Coroutines
- Suspending vs Blocking in Kotlin Coroutines
- Launch vs Async in Kotlin Coroutines
- Dispatchers in Kotlin Coroutines
- coroutineScope vs supervisorScope
- suspend function in Kotlin Coroutines
- Kotlin withContext vs Async-await
- CoroutineContext in Kotlin
- Callback to Coroutines in Kotlin
- Retrofit with Kotlin Coroutines
- Parallel Multiple Network Calls Using Kotlin Coroutines
- Room Database with Kotlin Coroutines
- Unit Testing ViewModel with Kotlin Coroutines and LiveData
Kotlin Flow API
Topics you should know in Kotlin Flow API for Android Interview:
- Flow Builder, Operator, Collector
- flowOn, dispatchers
- Operators such as filter, map, zip, flatMapConcat, retry, debounce, distinctUntilChanged, flatMapLatest
- Terminal operators
- Cold Flow vs Hot Flow
- StateFlow, SharedFlow, callbackFlow, channelFlow
- Mastering Flow API in Kotlin
- Creating Flow Using Flow Builder in Kotlin
- Terminal Operators in Kotlin Flow
- Cold Flow vs Hot Flow
- StateFlow and SharedFlow
- Long-running tasks in parallel with Kotlin Flow
- Retry Operator in Kotlin Flow
- Retrofit with Kotlin Flow
- Room Database with Kotlin Flow
- Kotlin Flow Zip Operator for Parallel Multiple Network Calls
- Instant Search Using Kotlin Flow Operators
- callbackFlow - Callback to Flow API in Kotlin
- Exception Handling in Kotlin Flow
- Unit Testing ViewModel with Kotlin Flow and StateFlow
Kotlin
Android Interview Questions and Answers:
- 15 Kotlin Interview Questions and Answers: Check the PDF
- When to use lateinit keyword used in Kotlin? - Learn from here
- What are
companion objectsin Kotlin? - Learn from here
- Extension functions - Learn from here
- What is a data class in Kotlin? - Learn from here
- Remove duplicates from an array in Kotlin - Learn from here
- noinline in Kotlin - Learn from here
- crossinline in Kotlin - Learn from here
- scope functions in Kotlin - Learn from here
- What is a reified keyword in Kotlin? - Learn from here
- lateinit vs lazy in Kotlin - Learn from here
- Advantage of using const in Kotlin - Learn from here
- What are higher-order functions in Kotlin? - Learn from here: Higher-Order Functions and Lambdas in Kotlin
- Write a function(Higher-Order Function) that returns a function. - Check solution here
- What are Lambdas in Kotlin - Learn from here: Higher-Order Functions and Lambdas in Kotlin
- AssociateBy - List to Map in Kotlin - Learn from here
- Open keyword in Kotlin - Learn from here
- Companion object in Kotlin - Learn from here
- internal visibility modifier in Kotlin - Learn from here
- partition - filtering function in Kotlin - Learn from here
- Infix notation in Kotlin - Learn from here
- How does the Kotlin Multiplatform work? - Learn from here
- Suspending vs Blocking in Kotlin Coroutines - Learn from here
- What is runBlocking in Coroutines? - Learn from here
- What is the meaning of structured concurrency in Kotlin Coroutines? - Learn from here
- String vs StringBuffer vs StringBuilder - Learn from here
- What is the difference between
valandvar? - Learn from here
- How to check if a
lateinitvariable has been initialized? - Learn from here
- How to do lazy initialization of variables in Kotlin? - Learn from here
- What are the visibility modifiers in Kotlin? - Learn from here
- What is the equivalent of Java static methods in Kotlin? - Learn from here
- How to create a Singleton class in Kotlin? - Learn from here
- What is the difference between
openandpublicin Kotlin? - Learn from here
applyscope function and its use cases - Learn from here
letscope function and its use cases - Learn from here
- Difference between List and Array types in Kotlin - Learn from here
- What are
Labelsin Kotlin? - Learn from here
- What are Coroutines in Kotlin? - Learn from here
- What is Coroutine Scope? - Learn from here
- Scopes in Kotlin Coroutines Used in Android - Learn from here
- What is Coroutine Context? - Learn from here
- Launch vs Async in Kotlin Coroutines - Learn from here
- Thread.sleep() vs delay() in Kotlin - Learn from here
- Explain inline classes in Kotlin - Learn from here
- Sealed Classes in Kotlin - Learn from here
- Sealed classes common use-cases in Android - Learn from here
- Tell about the Collections in Kotlin - Learn from here
- What does ?: do in Kotlin? (Elvis Operator) - Learn from here
- timeouts in Kotlin Coroutines - Learn from here
- How do you combine multiple coroutine results? - Learn from here
- What is a Job in Coroutines? - Learn from here
- Coroutines job.cancel() vs scope.cancel() - Learn from here
- What happens if an exception is thrown inside an async coroutine, but await() is never called? - Learn from here
- How to Implement Debounce Using Coroutines? - Learn from here
- Kotlin code snippet demonstrating how to run two coroutines in series and parallel - Learn from here
- yield in Kotlin Coroutines - Learn from here
- Delegates in Kotlin - Learn from here
- stateIn vs shareIn in Kotlin Flow - Learn from here
- flatMapConcat, flatMapMerge, and flatMapLatest in Kotlin Flow - Learn from here
- collect vs collectLatest in Kotlin Flow - Learn from here
Fast-Track Android Interview Preparation: Join Outcome School Android Program
Android
Android Interview Questions and Answers:
Base
- Why does an Android App lag? - Learn from here
- What is
Context? How is it used? - Context In Android Application
- How Zygote makes Android apps start faster? - How Zygote makes Android apps start faster?
- Tell all the Android application components. - Learn from here
- What is the project structure of an Android Application? - Learn from here
- What is
AndroidManifest.xml? - Learn from here
- What is the
Applicationclass? -Learn from here
Activity and Fragment
- Why is it recommended to use only the default constructor to create a
Fragment? - Learn from video and blog
- What is
Activityand its lifecycle? - Learn from here
- What is the difference between onCreate() and onStart() - Learn from here
- When only onDestroy is called for an activity without onPause() and onStop()? - Learn from here
- Why do we need to call setContentView() in onCreate() of Activity class? - Learn from here
- What is onSaveInstanceState() and onRestoreInstanceState() in activity? - Learn from here
- What is
Fragmentand its lifecycle? - Learn from here
- What is Bundle in Android? - Learn from here
- What are "launchMode"? - Learn from here and singleTask launchMode in Android
- What is the difference between a
Fragmentand anActivity? Explain the relationship between the two. - Learn from here
- When should you use a Fragment rather than an Activity?
- What is the difference between FragmentPagerAdapter vs FragmentStatePagerAdapter?
- What is the difference between adding/replacing fragment in backstack? - Learn from here
- How would you communicate between two Fragments?
- What is retained
Fragment? - Learn from here
- What is the purpose of
addToBackStack()while commiting fragment transaction?
Views and ViewGroups
- Optimizing layouts in Android - Learn from here
- What is
Viewin Android?
- Difference between
View.GONEandView.INVISIBLE? - Learn from here
- Can you a create custom view? How?
- What are ViewGroups and how they are different from the Views?
- What is a Canvas? - Learn from here
- What is a
SurfaceView? - Learn from here
- Relative Layout vs Linear Layout.
- Tell about Constraint Layout optimization - Learn from here
- Do you know what is the view tree? How can you optimize its depth? - Learn from here
Displaying Lists of Content
- What is the difference between
ListViewandRecyclerView? - Learn from here
- How does the RecyclerView work? - Learn from here
- RecyclerView Optimization - Scrolling Performance Improvement - Learn from here
- Optimizing Nested RecyclerView - Learn from here
- How does RecyclerView improve performance over ListView?
- What are the components of a RecyclerView?
- Explain the role of RecyclerView.Adapter and RecyclerView.ViewHolder - Learn from here
- What is a LayoutManager in RecyclerView?
- How do you handle multiple view types in a single RecyclerView?
- What is DiffUtil and how does it improve RecyclerView performance? - Learn from here
- What is the purpose of RecyclerView.setHasFixedSize(true)? - Learn from here
- How do you update a specific item in RecyclerView?
- What is
SnapHelper? - Learn from here: SnapHelper
Dialogs and Toasts
- What is
Dialogin Android? - Learn from here
- What is
Toastin Android? - Learn from here
- What the difference between
DialogandDialog Fragment? - Learn from here
Intents and Broadcasting
- What is
Intent? - Learn from here
- What is an Implicit
Intent? - Learn from here
- What is an Explicit
Intent? - Learn from here
- What is a
BroadcastReceiver? - Learn from here
- Describe how broadcasts and intents work to be able to pass messages around your app? - Learn from here
- What is a
PendingIntent?
- What are the different types of Broadcasts? - Learn from here
Services
- Explain Android Service Lifecycle - Learn from here
- What is Service? - Learn from here
- On which thread does a Service run in Android? - Learn from here
- Service vs IntentService - Learn from here
- What is a Foreground Service? - Learn from here
- What is a
JobScheduler? - Learn from here
- How Does WorkManager Guarantee Task Execution? - Learn from here
Inter-process Communication
- How can two distinct Android apps interact? - Learn from here
- Is it possible to run an Android app in multiple processes? How? - Learn from here
- What is AIDL? Enumerate the steps in creating a bounded service through AIDL. - Learn from here
- What can you use for background processing in Android? - Learn from here
- What is a
ContentProviderand what is it typically used for? - Learn from here
Long-running Operations
- How to run parallel tasks and get a callback when all are complete? - Long-running tasks in parallel with Kotlin Flow
- What is ANR? How can the ANR be prevented? - Learn from here
- ThreadPool Advantages - Learn from here
- Daemon Threads vs. User Threads - Learn from here
- Explain
Looper,Handler, andHandlerThread.
- Garbage Collection - Learn from here
- Memory Leak vs Out of Memory(OOM) Error - Learn from here
- Can you explain the difference between a Runnable and a Thread in Android? - Learn from here
Working With Multimedia Content
- How do you handle bitmaps in Android as it takes too much memory? - Learn from here and here
- Tell about the
Bitmappool. - Learn from here
Data Saving
- Jetpack DataStore Preferences - Learn from here
- Persisting Data in an Android App - Learn from here
- What is ORM? How does it work?
- How would you preserve the
Activitystate during a screen rotation? - Learn from here
- What are different ways to store data in your Android app? - Learn from here
- Explain Scoped Storage in Android.
- How to encrypt data in Android?
- What is commit() and apply() in SharedPreferences?
Look and Feel
- What is a
Spannable?
- What is a
SpannableString?
- What are the best practices for using text in Android?
- How to implement Dark mode in any application?
Fast-Track Android Interview Preparation: Join Outcome School Android Program
Memory Optimizations
- Improve Android App Performance - Learn from here
- What is the
onTrimMemory()method? - Learn from here
- How to identify and fix OutOfMemory issues?
- How do you find memory leaks in Android applications?
Battery Life Optimizations
- How Android Implements Adaptive Battery Using ML? - How Android Implements Adaptive Battery Using ML?
- How to reduce battery usage in an Android application?
- What is Doze? What about App Standby? - Learn from here
- What is
overdraw? - Learn from here
Supporting Different Screen Sizes
- How do you support different types of resolutions? - Learn from here
Permissions
- What are the different protection levels in permission?
Native Programming
- What is the NDK and why is it useful? - Learn from here: Android NDK and RenderScript
- What is renderscript? - Learn from here: Android NDK and RenderScript
Android System Internal
- What is Android Runtime? - Android Runtime
- Dalvik, ART, JIT, and AOT in Android - Dalvik, ART, JIT, and AOT
- What are the differences between Dalvik and ART? - Difference between Dalvik and ART
- Baseline Profiles - Learn from here
- What is DEX? - Learn from here
- What is Multidex in Android? - Learn from here
- Can you manually call the Garbage collector? - Is it possible to force Garbage Collection in Android?
- Android App Starts: Hot, Warm & Cold - Android App Starts: Hot, Warm & Cold
Android Jetpack
- What is Android Jetpack and why to use this?
- What is a ViewModel and how is it useful? Learn: What is a ViewModel and how is it useful?
- SharedViewModel in Android Learn: SharedViewModel in Android
- What are Android Architecture Components?
- StateFlow vs LiveData in Android Development Learn: StateFlow vs LiveData
- What is LiveData in Android? What is LiveData in Android?
- How is LiveData different from ObservableField?
- What is the difference between setValue and postValue in LiveData? Learn: setValue() vs postValue() in LiveData
- How do you share ViewModel between Fragments in Android? Learn: SharedViewModel in Android
- Explain WorkManager and its use cases.
- Minimum repeat interval allowed when scheduling a PeriodicWorkRequest using WorkManager - Learn from here
- How Does WorkManager Guarantee Task Execution? - Learn from here
- How does ViewModel work internally?
Others
- What is the difference between Serializable and Parcelable? Which is the best approach in Android? - Learn from here
- Why Bundle class is used for data passing and why cannot we use simple Map data structure? - Learn from here
- How do you troubleshoot a crashing application? - Learn from here
- Explain the Android push notification system? Learn from here: How does the Android push notification system work?
- What is AAPT? - Learn from here
- FlatBuffers vs JSON.
HashMap,ArrayMapandSparseArray- Learn from here
- Advantages of SparseArray in Android - Learn from here
- What are Annotations? - Learn from here
- How to create custom Annotation? - Learn from here
- What is the Android Support Library? Why was it introduced? - Learn from here
- What is Android Data Binding?
Android Libraries
Android Interview Questions and Answers:
- Explain OkHttp Interceptor - Learn from here
- OkHttp - HTTP Caching - Learn from here
- How to enable logging in OkHttp? - Learn from here
- Why do we use the Dependency Injection Framework like Dagger in Android? - Learn from here
- Explain @ Inject, @ Module, @ Provides, @ Component Annotations in Dagger 2 - Learn from here
- How does the Dagger work?
- How will you choose between Dagger 2 and Dagger-Hilt?
- What is a Component in Dagger?
- What is Module in Dagger?
- How does the custom scope work in Dagger?
- When to call dispose and clear on CompositeDisposable in RxJava? - Learn from here
- What is Multipart Request in Networking?
- What is Flow in Kotlin? - Learn from here
- App Startup Library - Learn from here
- Tell me something about RxJava.
- How will you handle error in RxJava?
- FlatMap Vs Map Operator - Learn from here
- When to use
Createoperator and when to usefromCallableoperator of RxJava? - Learn from here: RxJava Create and fromCallable Operator
- When to use
deferoperator of RxJava? - Learn from here: RxJava Defer Operator
- How are Timer, Delay, and Interval operators used in RxJava? - Learn from here
- How to make two network calls in parallel using RxJava? - RxJava Zip Operator
- Tell the difference between Concat and Merge. - Learn from here and here
- Explain Subject in RxJava? - Learn from here
- What are the types of Observables in RxJava? - Learn from here: Types Of Observables In RxJava
- How to implement search feature using RxJava in your application? - Learn from here: Instant Search Using RxJava Operators
- Pagination In RecyclerView Using RxJava Operators - Learn from here
- How The Android Image Loading Library Glide and Fresco Works? - Learn from here, here and here
- Difference between Schedulers.io() and Schedulers.computation() in RxJava.
Fast-Track Android Interview Preparation: Join Outcome School Android Program
Android Architecture
Android Interview Questions and Answers:
- Describe the architecture of your last app.
- Describe MVVM. - MVVM Architecture
- MVC vs MVP vs MVVM architecture.
- Clean Architecture - Learn from here
- Software Architecture vs Software Design - Learn from here
- Benefits of Multi-Module Architecture - Learn from here
- Multi-Module Project: Why and When? - Learn from here
Design Pattern
Android Interview Questions and Answers
- Builder - Learn from here
- Singleton
- Factory - Learn from here
- Observer - Learn from here
- Repository
- Adapter
- Facade
- Dependency Injection
- Strategy Pattern - Learn from here
- Design Pattern used in Android - Learn from here
- Kotlin Optional Parameters vs Builder Pattern - Learn from here
- Examples of the Observer pattern used in Android - Learn from here
- Design Pattern Used in Retrofit Library Source Code - Learn from here
- Design Pattern used in Glide (Image Loading Library) - Learn from here
- Design Patterns used in AOSP (Android Open Source Project) - Learn from here
Android System Design
Android Interview Questions and Answers:
Refer to this blog: Android System Design Interviews
- Design an Image Loading Library - Learn from here, here and here
- Design File Downloader Library - Learn from here
- Design WhatsApp
- Design Instagram Stories
- Design Networking Library
- Design Facebook Near-By Friends App
- Design Caching Library.
- Design problems based on location-based app
- How to build an offline-first app? Explain the architecture
- Design LRU Cache
- Design Analytics Library
- Design Logging Library - Learn from here
- HTTP Request vs HTTP Long-Polling vs WebSocket vs Server-Sent Events - Learn from blog and Video - HTTP Request vs HTTP Long-Polling vs WebSocket vs Server-Sent Events
- How do Voice And Video Call Work? - Learn from here
- In an Android App, how do you handle data syncing when the network isnβt stable? - Handling Android Data Sync on Unstable Networks
- Design Uber App - Learn from here
- How "Where Is My Train" Works Without Internet? - How "Where Is My Train" Works Without Internet?
- Database Normalization vs Denormalization - Database Normalization vs Denormalization
- Hash vs Encrypt vs Encode - Learn from here
- Webhook vs Polling - Learn from here
- Options for real-time updates in an Android App - Learn from here
- Options for Network Optimization in a Mobile App - Options for Network Optimization in a Mobile App
- Firebase Remote Config in Android - Firebase Remote Config in Android
- Accurate time in Android - Learn from here
- Query Optimization in SQLite for Better Performance - Learn from here
- WebSocket vs Socket.IO - Learn from here
- Symmetric vs Asymmetric Encryption - Learn from here
- SMS Retriever API in Android - Learn from here
Fast-Track Android Interview Preparation: Join Outcome School Android Program
Android Unit Testing
Android Interview Questions and Answers:
- Unit Testing ViewModel with Kotlin Coroutines and LiveData - Learn from here
- Unit Testing ViewModel with Kotlin Flow and StateFlow - Learn from here
- What is Espresso? - Learn from here
- What is Robolectric? - Learn from here
- What are the disadvantages of using Robolectric? - Learn from here
- What is UI-Automator? - Learn from here
- Explain the unit test. - Learn from here
- Explain instrumented test. - Learn from here
- Why Mockito is used? - Learn from here
- Describe code coverage. - Learn from here
Android Tools And Technologies
Android Interview Questions and Answers:
- CI/CD Pipeline for Android - Learn from here
- What is ADB? - Learn from here
- 16 KB page size for Android Apps - Learn from here
- What is the StrictMode? - Learn from here: StrictMode
- What is Lint? What is it used for?
- Android App Release Checklist For The Production Launch - Learn from here: Android App Release Checklist For The Production Launch
- Git.
- Firebase. - Learn from here
- How to measure method execution time in Android?
- Can you access your database of SQLite Database for debugging? - Learn from here
- What are things that we need to take care while using Proguard?
- How to use Android Studio Memory Profiler?
- What is Kotlin DSL for Gradle? - Learn from here
- implementation vs api in Gradle - Learn from here
- What is Gradle?
- Gradle related files in Android Project - Learn from here
- How do you create a custom task in Gradle? - Learn from here
- annotationProcessor, kapt, ksp in Gradle - Learn from here
- Build Variants in Android - Learn from here
- Desugaring in Android - Learn from here
- APK Size Reduction.
- How can you speed up the Gradle build?
- About gradle build system.
- About multiple apk for Android Apps.
- What is ProGuard used for? - Learn from here
- What is proguard-rules.pro file used for? - Learn from here
- ProGuard vs R8 in Android - Learn from here
- What is obfuscation? What is it used for? What about minification?
- How to change some parameters in an app without app update? - Firebase Remote Config in Android
- What is Write-Ahead Logging (WAL) and why it is used internally in databases? - Learn from here
Jetpack Compose
Topics you should know in Jetpack Compose for Android Interview:
- Compose
- State: remember, rememberSaveable, MutableState
- Recomposition
- State hoisting
- Side-effects
- Modifier
- Theme
- Layout, List
- Gestures, Animation
- CompositionLocal
- Phases
- Getting Started with Compose
- Thinking in Compose
- State
- remember vs rememberSaveable
- Lifecycle
- Modifiers
- Side-effects
- Phases
README truncated. View on GitHub