An Android Developer is a person who builds apps for Android phones and tablets, just like the apps we use every day for games, shopping, chatting, or learning. In this job, Android Developers create new apps, improve existing ones, and fix problems. They use tools like Android Studio, programming languages like Kotlin or Java, and special libraries to make sure apps work smoothly and safely.
Preparing well for an Android Developer interview is very important. Interviews often include questions about app design, performance issues, and real coding tasks. By practicing questions, you’ll feel more confident and ready to explain your ideas clearly.
In this guide, we are sharing many popular Android interview questions and answers for both beginners (freshers) and experienced professionals. We also included real-life scenario-based questions to help you think like a professional developer.
Table of Contents
Android Developer Interview Questions and Answers for Fresher
Que 1. What is the AndroidManifest.xml file used for?
Answer:
The AndroidManifest.xml file provides essential information about your app to the Android system. It declares app components like activities, services, broadcast receivers, permissions, and hardware features required by the app.
Que 2. What are Activities in Android?
Answer:
An Activity represents a single screen with a user interface. Activities manage user interactions and navigate between screens using intents.
Que 3. What is the difference between implicit and explicit intents?
Answer:
- Explicit Intent: Launches a specific component within your app.
- Implicit Intent: Requests an action from another app (e.g., share content, open a browser).
Que 4. What is the purpose of Gradle in Android development?
Answer:
Gradle automates the build process, managing dependencies and project configurations. It compiles code, packages APK files, and handles library versions.
Que 5. What is the Android Activity Lifecycle?
Answer:
The Activity Lifecycle manages states of an activity using methods like:
onCreate()
onStart()
onResume()
onPause()
onStop()
onDestroy()
Each method handles transitions between states to manage resources efficiently.
Que 6. What are Fragments in Android?
Answer:
Fragments are reusable UI components that can be combined within activities. They help build flexible and dynamic UIs, especially on larger screens like tablets.
Que 7. What is ViewModel in Android?
Answer:
ViewModel is part of Android Jetpack that stores UI-related data in a lifecycle-aware way. It helps manage data during configuration changes like screen rotations.
Que 8. What is LiveData in Android?
Answer:
LiveData is an observable data holder class that updates the UI automatically when data changes. It is lifecycle-aware and works with ViewModel to build reactive UIs.
Que 9. How is data stored locally in Android apps?
Answer:
- SharedPreferences for small key-value pairs.
- Room Database for structured relational data.
- Internal/External Storage for files.
- DataStore (modern alternative to SharedPreferences).
Que 10. What is the difference between Serializable and Parcelable?
Answer:
Feature | Serializable | Parcelable |
---|---|---|
Usage | Java standard | Android-specific |
Performance | Slower | Faster |
Implementation | Easier | More complex |
Use Parcelable for passing data between Android components.
Que 11. What is a RecyclerView?
Answer:
RecyclerView is an advanced version of ListView used to display large sets of data efficiently. It recycles views to improve performance and supports layout managers, item animations, and custom adapters.
Que 12. What is Data Binding in Android?
Answer:
Data Binding connects UI components in XML layouts directly to data sources in code, reducing boilerplate code and improving app architecture.
Que 13. What is Dependency Injection and how is it used in Android?
Answer:
Dependency Injection (DI) provides objects a class depends on, rather than creating them inside the class. Popular DI frameworks in Android include Dagger and Hilt.
Que 14. How can you perform background tasks in Android?
Answer:
- WorkManager: For deferrable and guaranteed tasks.
- JobScheduler: For API 21+.
- Services: For long-running tasks (with caution).
- Coroutines: For lightweight background operations.
Que 15. What is CoroutineScope in Android?
Answer:
CoroutineScope defines the lifecycle of coroutines. Developers use lifecycle-aware scopes like viewModelScope
or lifecycleScope
to launch coroutines that automatically cancel when the lifecycle ends.
Que 16. What are Content Providers in Android?
Answer:
Content Providers manage shared app data and allow other apps to read/write data with permission. They handle data access using URIs and facilitate inter-app data sharing.
Que 17. How do you handle permissions in Android?
Answer:
- Normal permissions are granted at install.
- Dangerous permissions require runtime requests using
requestPermissions()
and handling callbacks inonRequestPermissionsResult()
.
Que 18. What is ProGuard in Android?
Answer:
ProGuard is a tool that shrinks, optimizes, and obfuscates code to make APK files smaller and protect code from reverse engineering.
Que 19. What is MVVM architecture in Android?
Answer:
Model-View-ViewModel (MVVM) separates concerns in app development:
- Model: Manages data.
- View: Handles UI.
- ViewModel: Acts as a communication bridge and holds UI logic.
It improves testability and code maintenance.
Que 20. What are some key libraries used in Android development?
Answer:
- Retrofit / OkHttp – For network calls.
- Room – For database management.
- Glide / Picasso – For image loading.
- Hilt / Dagger – For Dependency Injection.
- Jetpack Compose – For building UIs declaratively.

Also Check: Software Engineer Interview Questions and Answers
Que. 21 What is an APK file in Android?
Answer:
An APK (Android Package Kit) is the file format used to distribute and install Android applications. It is essentially a ZIP archive containing all the necessary components for the app, such as compiled code (DEX files), resources (images, layouts), assets, certificates, and the AndroidManifest.xml file. When you build an Android app, the build tools (like Gradle) package everything into an APK, which can then be signed and uploaded to the Google Play Store or sideloaded.
For freshers, understanding APK is important because it relates to app deployment. You can generate an APK using Android Studio’s Build > Build Bundle(s)/APK(s) menu. To install, use adb install app.apk
via ADB.
Que. 22 What is the role of ADB in Android development?
Answer:
ADB (Android Debug Bridge) is a command-line tool that allows communication between a computer and an Android device or emulator. It is part of the Android SDK and enables tasks like installing/uninstalling apps, transferring files, debugging, taking screenshots, and accessing device logs (via adb logcat
). It acts as a bridge for development, testing, and debugging.
Example command: adb devices
lists connected devices. For freshers, ADB is essential for testing on physical devices without Android Studio’s GUI.
Que. 23 What is an Intent Filter in Android?
Answer:
An Intent Filter is an XML declaration in the AndroidManifest.xml file that specifies the types of intents an activity, service, or broadcast receiver can respond to. It acts like a “filter” to declare what actions, categories, or data types a component can handle, allowing the system to route implicit intents correctly.
Example in manifest:
<activity android:name=".MyActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
</intent-filter>
</activity>
This allows the activity to handle HTTP links. Freshers should know this for app integration with other apps.
Que. 24 What is the difference between a Service and a BroadcastReceiver in Android?
Answer:
A Service is a component that runs in the background to perform long-running operations without a UI, such as playing music or downloading files. It can be started (runs indefinitely) or bound (for interaction). A BroadcastReceiver, on the other hand, is a component that listens for system-wide or app-specific broadcast events (like battery low or boot completed) and responds briefly, without persisting.
Services can be foreground for priority, while BroadcastReceivers are event-driven and short-lived. Example: Use a Service for ongoing location updates, and a BroadcastReceiver for SMS received events.
Que. 25 What is AsyncTask in Android, and why is it deprecated?
Answer:
AsyncTask is a class that simplifies running background operations on a separate thread while updating the UI on the main thread. It has methods like doInBackground
for heavy work, onPreExecute
for setup, onPostExecute
for results, and onProgressUpdate
for progress.
It is deprecated since Android 11 because it can lead to memory leaks (holds activity reference) and doesn’t handle configuration changes well. Alternatives include Kotlin Coroutines, Executors, or WorkManager for robust background tasks.
Example skeleton:
private class MyTask extends AsyncTask<Void, Void, String> {
protected String doInBackground(Void... params) {
// Background work
return "Done";
}
protected void onPostExecute(String result) {
// Update UI
}
}
Freshers should migrate to modern alternatives.
Que. 26 What is a Handler in Android?
Answer:
A Handler is a class that allows sending and processing Message or Runnable objects associated with a thread’s MessageQueue. It is used for inter-thread communication, especially to update the UI from background threads (since only the main thread can touch UI).
Example:
Handler handler = new Handler(Looper.getMainLooper());
handler.post(() -> {
// Update UI here
});
Or with delay: handler.postDelayed(runnable, 1000);
. It’s foundational for threading in Android apps.
Que. 27 What is Looper in Android?
Answer:
Looper is a class that turns a thread into a message loop, processing Messages and Runnables from a MessageQueue. The main thread (UI thread) has a Looper by default, but you can create one for worker threads using Looper.prepare()
and Looper.loop()
.
It’s crucial for Handlers to work, as Handlers attach to a Looper. Without Looper, a thread can’t process queued tasks. Freshers encounter this in custom threading scenarios.
Que. 28 What is the difference between margin and padding in Android layouts?
Answer:
Margin is the space outside a view’s borders, separating it from other views or the parent container. Padding is the space inside a view’s borders, between the content and the view’s edges.
In XML:
<TextView
android:layout_margin="16dp" <!-- Outside space -->
android:padding="8dp" /> <!-- Inside space -->
Margin affects layout positioning, while padding affects content placement within the view. Important for UI design.
Que. 29 What are the different types of layouts in Android?
Answer:
Android provides several layout types for arranging views:
- LinearLayout: Arranges children in a single row or column.
- RelativeLayout: Positions children relative to each other or the parent.
- ConstraintLayout: Flexible, positions views with constraints (preferred for complex UIs).
- FrameLayout: Stacks children on top of each other.
- GridLayout: Arranges in a grid.
- TableLayout: Like HTML tables.
ConstraintLayout is recommended for performance. Example: Use LinearLayout for simple vertical lists.
Que. 30 What is a Nine-Patch image in Android?
Answer:
A Nine-Patch (.9.png) is a resizable bitmap image that defines stretchable and static areas using 1-pixel borders. The black lines on the edges indicate stretch regions, allowing the image to scale without distortion for backgrounds or buttons.
Create in Android Studio’s Drawable editor. Useful for UI elements that need to fit different sizes, like chat bubbles.
Also Check: Android Developer Interview Questions for Freshers
Que. 31 What is SQLite in Android, and how do you use it?
Answer:
SQLite is a lightweight, embedded relational database engine built into Android for local data storage. It supports SQL queries and is file-based, no server needed.
To use: Extend SQLiteOpenHelper for database creation/upgrades, then use SQLiteDatabase for CRUD operations.
Example:
public class MyDbHelper extends SQLiteOpenHelper {
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)");
}
}
// Usage: SQLiteDatabase db = helper.getWritableDatabase(); db.insert("users", null, values);
Ideal for structured data like user profiles.
Que. 32 What is AIDL in Android?
Answer:
AIDL (Android Interface Definition Language) defines interfaces for inter-process communication (IPC) between apps or services. It generates Java code for binding, allowing method calls across processes.
Used for bound services exposing APIs. Example: Define .aidl file with methods, implement in service, bind from client.
Freshers should know it’s for secure, cross-app communication.
Que. 33 How do you handle network connectivity changes in Android?
Answer:
Monitor network changes using ConnectivityManager and NetworkCallback (API 21+), or BroadcastReceiver for older APIs (deprecated in Q).
Example with NetworkCallback:
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
cm.registerDefaultNetworkCallback(new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(Network network) {
// Network available
}
@Override
public void onLost(Network network) {
// Network lost
}
});
Show offline messages or queue requests. Important for robust apps.
Que. 34 What is the difference between getContext(), getApplicationContext(), and this in Android?
Answer:
this
: Refers to the current class instance (e.g., Activity).getContext()
: Returns the context of the current view or fragment.getApplicationContext()
: Returns the global application context, valid for the app’s lifetime.
Use getApplicationContext()
for app-wide operations to avoid leaks; this
or getContext()
for UI-related tasks. Misuse can cause memory leaks.
Que. 35 What is an Android Emulator, and how do you use it?
Answer:
An Android Emulator simulates Android devices on a computer for testing apps without physical hardware. It’s part of Android Studio’s AVD Manager, where you create virtual devices with specific OS versions, hardware configs.
To use: Create AVD, run app via Run > Select Device. Supports features like GPS simulation. Freshers use it for debugging across API levels.
Que. 36 What is the purpose of the res folder in Android projects?
Answer:
The res (resources) folder contains non-code assets like layouts (XML), drawables (images), strings, colors, and menus. It’s organized into subfolders (e.g., res/layout, res/drawable) and supports qualifiers for different configurations (e.g., res/drawable-hdpi for high-density screens).
Compiled into binary format during build. Essential for separating UI from code.
Que. 37 How do you create a custom View in Android?
Answer:
Extend View or a subclass (e.g., TextView), override methods like onDraw
for rendering, onMeasure
for sizing, and onTouchEvent
for interactions.
Example:
public class CustomView extends View {
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// Draw shapes, text
canvas.drawCircle(50, 50, 30, paint);
}
}
Add to layout XML. Used for unique UI elements like graphs.
Que. 38 What is the difference between px, dp, sp, and pt in Android?
Answer:
- px: Pixels, device-specific, not recommended for layouts.
- dp (dip): Density-independent pixels, scales with screen density (use for layouts).
- sp: Scale-independent pixels, like dp but scales with font size preference (use for text).
- pt: Points, 1/72 inch, rarely used.
Always use dp/sp for responsive UIs. Conversion: px = dp * (dpi / 160).
Que. 39 How do you implement a ListView in Android?
Answer:
ListView displays scrollable lists using an Adapter (e.g., ArrayAdapter) to bind data.
Example:
ListView listView = findViewById(R.id.list);
String[] data = {"Item1", "Item2"};
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, data);
listView.setAdapter(adapter);
Deprecated in favor of RecyclerView for efficiency, but still used in simple cases.
Que. 40 What is the Android SDK, and what tools does it include?
Answer:
The Android SDK (Software Development Kit) provides libraries, APIs, and tools for building Android apps. Includes ADB, AAPT (for packaging), Emulator, Build Tools (for compiling), Platform Tools, and SDK Manager for downloads.
Install via Android Studio. Freshers start with SDK to set up development environment.
Also Check: iOS Interview Questions and Answers PDF
Android Developer Interview Questions and Answers for Experienced Senior
Que 41. What is Jetpack Compose and how does it differ from XML layouts?
Answer:
Jetpack Compose is Android’s modern toolkit for building native UIs declaratively using Kotlin. Unlike traditional XML layouts, Compose uses composable functions for UI, reducing boilerplate code and improving performance and flexibility.
Que 22. Explain the role of WorkManager in Android.
Answer:
WorkManager is an API that schedules deferrable, asynchronous tasks that need guaranteed execution, even if the app exits or the device restarts. It supports constraints like network availability and charging status.
Que 43. How does Navigation Component simplify app navigation?
Answer:
Navigation Component simplifies navigation by handling fragment transactions, back stack management, and deep linking using a navigation graph. It allows safe argument passing between destinations using SafeArgs.
Que 44. How do you implement Dependency Injection using Hilt in Android?
Answer:
Hilt automates DI setup using annotations like @HiltAndroidApp
, @Inject
, @Module
, and @Provides
. It simplifies the dependency injection process compared to Dagger and integrates seamlessly with ViewModel, Activities, and Fragments.
Que 45. What is the difference between StateFlow and LiveData?
Answer:
Feature | StateFlow | LiveData |
---|---|---|
Lifecycle | Not lifecycle-aware | Lifecycle-aware |
Emission | Emits current and new values | Emits only new values |
Use Case | Kotlin coroutines-based | UI binding |
Que 46. What are the best practices for app performance optimization?
Answer:
- Use lazy loading and pagination
- Avoid memory leaks with LeakCanary
- Use ConstraintLayout to flatten UI hierarchy
- Perform heavy operations off the main thread
- Minimize overdraw and remove unused resources
Que 47. How do you handle configuration changes effectively?
Answer:
Use ViewModel for retaining data, resource qualifiers for UI changes, and persist UI state using onSaveInstanceState()
to restore after configuration changes like screen rotation.
Que 48. How does Paging Library work?
Answer:
Paging Library helps load large datasets in smaller chunks or pages. It supports loading from databases and network sources, improving scrolling performance and memory usage when displaying large lists.
Que 49. Explain sealed classes in Kotlin with an example.
Answer:
Sealed classes restrict inheritance to known types, useful in representing limited states or events. Example:
sealed class Result
data class Success(val data: String): Result()
object Error : Result()
Que 50. How do you implement push notifications in Android?
Answer:
Use Firebase Cloud Messaging (FCM). Implement FirebaseMessagingService
, override onMessageReceived()
, and show notifications using NotificationManager. Use notification channels for API 26+ for proper notification handling.
Que 51. What is the difference between cold and hot flows in Kotlin?
Answer:
Cold flows emit data only when actively collected, while hot flows emit data regardless of collectors. StateFlow and SharedFlow are hot; regular Flow is cold.
Que 52. How can you secure sensitive data in Android?
Answer:
Use EncryptedSharedPreferences, Android Keystore, avoid plain-text storage, use HTTPS for network requests, and obfuscate code using ProGuard or R8 to prevent reverse engineering.
Que 53. What is Retrofit and how does it simplify API calls?
Answer:
Retrofit simplifies network calls using annotations for defining endpoints. It converts API responses into data models using Gson or Moshi and supports coroutines and RxJava for asynchronous calls.
Que 54. How do you manage app versioning in Android?
Answer:
Update versionCode
and versionName
in build.gradle
for each release. Follow semantic versioning. Use CI/CD pipelines to automate version updates for build consistency.
Que 55. What are BroadcastReceivers and their use cases?
Answer:
BroadcastReceivers respond to system-wide broadcast announcements like network changes or SMS received. They are useful for reacting to system events or custom events within apps.
Que 56. How do you optimize battery usage in an Android app?
Answer:
Avoid long-running services, schedule tasks using WorkManager, reduce frequent wake-ups, use efficient network calls, and respect Doze Mode and App Standby features to save battery.
Que 57. What are Coroutines in Kotlin and why are they used?
Answer:
Coroutines enable asynchronous programming using lightweight threads, helping manage tasks like network calls without blocking the main thread. They simplify concurrency and improve app performance.
Que 58. How does Jetpack Compose handle state management?
Answer:
Jetpack Compose uses remember
and mutableStateOf
for managing state within composables. State hoisting patterns help move state management to parent composables, ensuring UI recomposes efficiently.
Que 59. How do you implement dynamic feature modules in Android?
Answer:
Use Android App Bundles to modularize features. Dynamic feature modules can be downloaded and installed at runtime, reducing initial APK size and improving app delivery.
Que 60. What is App Startup Library and why is it important?
Answer:
App Startup Library initializes app components in an optimized sequence during launch. It reduces app startup time by loading only necessary initializers, improving overall app performance.
Also Check: Java interview Questions and Answers
Que. 61 How do you implement and manage multi-module architecture in a large-scale Android app?
Answer:
Multi-module architecture divides an app into feature modules (e.g., :app, :feature-login, :core-network) to improve build times, scalability, and team collaboration. For seniors, focus on dynamic delivery with Android App Bundles, where modules can be instant or install-time. Use Gradle for dependencies: In settings.gradle, include modules; in build.gradle, use implementation(project(“:module”)). Manage with dependency graphs via tools like Dagger/Hilt for injection across modules.
Advantages: Parallel builds (faster CI), code isolation (reduces merge conflicts). Challenges: Circular dependencies—resolve with dependency inversion.
Example structure:
- :app (main module)
- :core (shared utilities)
- :feature1 (depends on :core)
In build.gradle (feature1):
dependencies {
implementation project(':core')
}
For dynamic features: Use com.android.dynamic-feature
in module build.gradle. This reduces APK size by 20-30% and speeds builds in large teams.
Que. 62 What are the best practices for handling memory leaks in Android apps?
Answer:
Memory leaks occur when objects (e.g., Activities) are retained longer than needed, often due to static references or unclosed resources. Best practices: Use LeakCanary for detection—it hooks into the app and reports leaks via notifications. Avoid static views/contexts; use WeakReferences instead. In Fragments, detach listeners in onDestroyView(). For images, use Glide/Picasso with caching controls.
Profile with Android Profiler: Monitor heap dumps for retained objects. In RxJava/Coroutines, dispose subscriptions in lifecycle methods.
Example with WeakReference:
class MyClass(private val context: WeakReference<Context>) {
fun doSomething() {
context.get()?.let { /* use it */ }
}
}
For seniors, emphasize proactive monitoring in CI with tools like Detekt for static analysis, reducing crashes by identifying leaks early.
Que. 63 Explain how to implement custom animations in Android using Property Animation.
Answer:
Property Animation animates object properties (e.g., alpha, scale) over time using ValueAnimator or ObjectAnimator. For complex, use AnimatorSet for sequencing.
Example: Fade in a view:
val fadeIn = ObjectAnimator.ofFloat(view, "alpha", 0f, 1f)
fadeIn.duration = 500
fadeIn.start()
For combined:
val set = AnimatorSet()
set.playTogether(ObjectAnimator.ofFloat(view, "translationX", 0f, 200f), ObjectAnimator.ofFloat(view, "scaleX", 1f, 1.5f))
set.start()
Overrides like onAnimationEnd() for callbacks. Seniors should discuss hardware acceleration (android:hardwareAccelerated=”true” in manifest) for smooth 60fps, and XML animators for reusability.
Que. 64 How does Dagger differ from Hilt in dependency injection for Android?
Answer:
Dagger is a compile-time DI framework requiring manual component/module setup, while Hilt is a Jetpack library built on Dagger, simplifying with annotations like @HiltAndroidApp, @AndroidEntryPoint, and predefined components (e.g., SingletonComponent).
Dagger offers more flexibility but more boilerplate; Hilt reduces it with auto-generated code and scopes like @ViewModelScoped.
Migration: Add Hilt dependencies, annotate Application class. Advantages of Hilt: Faster setup, built-in ViewModel integration. For large apps, Hilt cuts DI code by 50%.
Example Hilt module:
@Module
@InstallIn(SingletonComponent::class)
object AppModule {
@Provides
fun provideApi(): Api = Retrofit.create(Api::class.java)
}
Seniors use it for testable, modular code.
Que. 65 What strategies would you use to optimize RecyclerView performance for large datasets?
Answer:
For large lists, use DiffUtil for efficient updates (compute differences off-main thread). Set setHasFixedSize(true)
if item count is known. Use ViewHolder pattern properly, avoiding findViewById in bind.
For images, lazy load with Glide (requestManager.load().into()). Prefetch with setItemPrefetchEnabled(true)
in LinearLayoutManager. Handle pagination with Paging 3.
Monitor with Layout Inspector for overdraw. In code:
class MyDiffCallback : DiffUtil.ItemCallback<Item>() {
override fun areItemsTheSame(old: Item, new: Item) = old.id == new.id
override fun areContentsTheSame(old: Item, new: Item) = old == new
}
adapter.submitList(newList) // With ListAdapter
This achieves smooth 60fps scrolling, critical for feed apps.
Que. 66 How do you implement biometric authentication in Android, including fallback mechanisms?
Answer:
Use BiometricPrompt API (androidx.biometric) for fingerprint/face. Check availability with BiometricManager.canAuthenticate(). Provide fallback like PIN via KeyguardManager.
Example:
val executor = ContextCompat.getMainExecutor(context)
val biometricPrompt = BiometricPrompt(activity, executor, object : BiometricPrompt.AuthenticationCallback() {
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
// Success
}
})
val promptInfo = BiometricPrompt.PromptInfo.Builder()
.setTitle("Biometric login")
.setAllowedAuthenticators(BIOMETRIC_STRONG or DEVICE_CREDENTIAL)
.build()
biometricPrompt.authenticate(promptInfo)
For crypto, use CryptoObject. Advantages: Secure, user-friendly. Seniors handle errors like BIOMETRIC_ERROR_NO_HARDWARE.
Que. 67 Explain the internals of Kotlin Coroutines and how dispatchers work.
Answer:
Coroutines are lightweight threads managed by Kotlin runtime, using Continuation Passing Style (CPS) for suspension/resumption without blocking. Internals: Coroutine builders like launch/create a Continuation, suspended at await() etc., resuming via callbacks.
Dispatchers: Default (CPU-intensive), IO (blocking I/O), Main (UI), Unconfined (no confinement). Custom via newSingleThreadContext().
Example:
GlobalScope.launch(Dispatchers.IO) {
// Network call
withContext(Dispatchers.Main) {
// Update UI
}
}
Seniors optimize with structured concurrency (CoroutineScope) to avoid leaks.
Que. 68 What are the best practices for implementing offline support in Android apps?
Answer:
Use Room for local caching, WorkManager for sync jobs. Fetch from API, store in DB; on offline, query DB. Use NetworkBoundResource pattern: Check DB, if stale, fetch API and update DB.
Handle conflicts with last-write-wins or merge logic. Monitor connectivity with ConnectivityManager.
Example flow:
fun getData(): Flow<Resource<Data>> = flow {
emit(Resource.Loading())
val local = repo.getLocal()
emit(Resource.Success(local))
if (shouldFetch(local)) {
try {
val remote = api.fetch()
repo.save(remote)
emit(Resource.Success(remote))
} catch (e: Exception) {
emit(Resource.Error(e.message))
}
}
}.flowOn(Dispatchers.IO)
This ensures seamless UX, vital for mobile apps.
Que. 69 How do you profile and optimize app startup time in Android?
Answer:
Use Android Profiler’s CPU/Method Tracing for bottlenecks. Optimize: Reduce dex methods, use App Startup library for init, lazy init components.
Tools: Benchmark with Macrobenchmark library (Jetpack), trace with Trace.beginSection(). Avoid heavy work in Application.onCreate(); defer to splash or background.
Example benchmark:
In build.gradle: Add benchmark dependencies, write tests measuring startup.
Reduces cold start by 30-50%, improving retention.

Que. 70 What is the role of Annotation Processing in Android, and how does it work with libraries like Room?
Answer:
Annotation Processing (APT) generates code at compile-time from annotations, using processors like in Dagger/Room. For Room, @Entity generates SQLite code.
Workflow: Compiler scans annotations, invokes processor (e.g., RoomProcessor), generates Java/Kotlin files.
Custom: Implement javax.annotation.processing.Processor.
Advantages: Type-safe, no runtime reflection (faster). Seniors use KAPT for Kotlin.
Que. 71 How would you implement secure communication with a backend API in Android?
Answer:
Use HTTPS with certificate pinning (OkHttp’s CertificatePinner) to prevent MITM. Authenticate with JWT/OAuth, store tokens in EncryptedSharedPreferences.
Intercept with OkHttp: Add authenticator for refresh. Validate inputs to prevent injection.
Example pinning:
val pinner = CertificatePinner.Builder()
.add("api.example.com", "sha256/ABC...")
.build()
val client = OkHttpClient.Builder().certificatePinner(pinner).build()
For seniors, discuss TLS 1.3, API key rotation.
Que. 72 Explain how to use Android’s Benchmark library for performance testing.
Answer:
Jetpack Benchmark measures code performance (e.g., FPS, execution time) in instrumented tests. Add dependencies: benchmark-macro-junit4.
Example test:
@LargeTest
class MyBenchmark {
@get:Rule val benchmarkRule = MacrobenchmarkRule()
@Test
fun startup() {
benchmarkRule.measureRepeated(
packageName = "com.example.app",
metrics = listOf(StartupTimingMetric()),
iterations = 5
) {
startActivityAndWait()
}
}
}
Run with Gradle: ./gradlew benchmark. Analyzes cold/warm starts, essential for senior optimization roles.
Que. 73 What are the advanced features of ConstraintLayout for complex UIs?
Answer:
ConstraintLayout uses constraints for flat hierarchies, reducing nesting. Advanced: Chains (group views horizontally/vertically with spread/packed), Barriers (dynamic positioning based on max size), Guidelines (percentage-based anchors), MotionLayout for animations.
Example chain:
<Button android:id="@+id/btn1" app:layout_constraintChainStyle="spread" ... />
<Button android:id="@+id/btn2" app:layout_constraintStart_toEndOf="@id/btn1" ... />
For seniors, it cuts draw passes by 50% vs nested LinearLayouts.
Que. 74 How do you implement unit testing for ViewModels in Android?
Answer:
Use JUnit, Mockito for mocks, and CoroutineTest for async. Add androidTest dependencies.
Example:
@HiltViewModel
class MyViewModel @Inject constructor(private val repo: Repo) : ViewModel() {
fun loadData() { /* ... */ }
}
@ExperimentalCoroutinesApi
class ViewModelTest {
@get:Rule val instantExecutorRule = InstantTaskExecutorRule()
@get:Rule val coroutineRule = MainCoroutineRule()
@Test
fun testLoadData() = runTest {
val mockRepo = mockk<Repo>()
coEvery { mockRepo.fetch() } returns "data"
val vm = MyViewModel(mockRepo)
vm.loadData()
assertEquals("data", vm.data.value)
}
}
Covers edge cases, ensures logic isolation.
Que. 75 What is the purpose of Android’s Instant Apps feature, and how do you implement it?
Answer:
Instant Apps allow running app modules without installation, via URLs, for quick experiences (e.g., parking payment).
Implement: Modularize with feature modules as instant-enabled in build.gradle (instant = true). Use App Links for deep linking.
Publish as bundle with instant flag. Advantages: Lower friction, higher engagement. Seniors handle size limits (<15MB per module).
Que. 76 How do you manage app theming and dark mode support in Android?
Answer:
Use MaterialTheme with DayNight mode. In styles.xml, extend Theme.MaterialComponents.DayNight. Detect: Configuration.UI_MODE_NIGHT_YES.
Force: AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES). For Compose: MaterialTheme with isSystemInDarkTheme().
Example attr:
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryDark">@color/purple_700</item> <!-- Adapts to mode -->
Ensures accessibility, user preference compliance.
Que. 77 Explain how to use Android’s Slice API for app actions in search.
Answer:
Slices provide rich, interactive content in Google Search/Assistant from ContentProviders. Extend SliceProvider, build Slices with ListBuilder/RowBuilder.
Example:
class MySliceProvider : SliceProvider() {
override fun onBindSlice(sliceUri: Uri): Slice? {
return ListBuilder(context!!, sliceUri, INFINITY)
.addRow(RowBuilder().setTitle("Title").setSubtitle("Subtitle"))
.build()
}
}
Declare in manifest with intent-filter for slices. Advantages: Engages users outside app.
Que. 78 What strategies do you use for handling app compatibility across different API levels?
Answer:
Use androidx libraries for backports (e.g., ActivityCompat for permissions). Check Build.VERSION.SDK_INT for conditional code.
Min SDK 21+, target latest. Deprecations: Migrate to alternatives (e.g., JobIntentService to WorkManager). Test on emulators of various levels.
Example:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
ContextCompat.checkSelfPermission(context, Manifest.permission.POST_NOTIFICATIONS)
} else {
// Fallback
}
Ensures broad reach without crashes.
Que. 79 How do you implement custom deserialization with Gson or Moshi in Android?
Answer:
For complex JSON, create TypeAdapters. With Moshi (preferred for codegen):
Example adapter:
class CustomAdapter : JsonAdapter<MyClass>() {
override fun fromJson(reader: JsonReader): MyClass? {
// Custom parsing
return MyClass(value)
}
override fun toJson(writer: JsonWriter, value: MyClass?) {
// Serialize
}
}
// Register: val moshi = Moshi.Builder().add(CustomAdapter()).build()
For Gson: JsonDeserializer. Handles edge cases like polymorphic types.
Que. 80 What is the role of Android’s WindowManager, and how do you use it for overlays?
Answer:
WindowManager manages windows (views outside activity), like system alerts or floating widgets. Add views with addView(), using WindowManager.LayoutParams for type (e.g., TYPE_APPLICATION_OVERLAY).
Permission: OVERLAY_PERMISSION (API 23+). Example for floating view:
val params = WindowManager.LayoutParams(WRAP_CONTENT, WRAP_CONTENT, TYPE_APPLICATION_OVERLAY, FLAG_NOT_FOCUSABLE, TRANSPARENT)
windowManager.addView(myView, params)
Remove with removeView(). For seniors, handle multi-window, security (overlays restricted in newer APIs).
Also Check: Android Developer Interview Questions for Experienced
Scenario Based Android Developer Interview Questions and Answers
Que 81. Scenario: Your app’s RecyclerView is lagging while scrolling large datasets. How would you solve this?
Answer:
- Use
Paging 3 Library
for loading data in chunks. - Optimize image loading using libraries like Glide with placeholders and caching.
- Avoid complex view hierarchies in item layouts.
- Use
ViewHolder
pattern properly and avoid recalculating data inonBindViewHolder()
.
Que 82. Scenario: After a screen rotation, your form data resets. How will you handle this?
Answer:
Store the form data in a ViewModel
which survives configuration changes. Alternatively, save temporary input in onSaveInstanceState()
and restore it in onCreate()
to retain user-entered data.
Que 83. Scenario: Users report that notifications are not showing on Android 8+. What could be the issue?
Answer:
Android 8+ requires using Notification Channels. Ensure notification channels are created with appropriate settings before sending notifications to guarantee delivery on newer Android versions.
Que 84. Scenario: Your background task doesn’t complete if the app is closed. How can you fix this?
Answer:
Use WorkManager
for guaranteed background execution. It persists across app restarts and uses appropriate APIs internally (AlarmManager, JobScheduler) to ensure tasks complete.
Que 85. Scenario: App crashes due to null pointer exceptions in LiveData observers. How do you prevent this?
Answer:
- Use null checks or Kotlin’s safe-call (
?.
) operators. - Initialize LiveData properly or provide default values.
- Use
MediatorLiveData
if merging multiple data sources.
Que 86. Scenario: App memory usage spikes when displaying images. What would you check?
Answer:
- Ensure image loading libraries (Glide, Picasso) use caching efficiently.
- Use appropriate image sizes using
resize()
oroverride()
. - Recycle or clear unused bitmaps.
- Use
MemoryCache
andDiskCache
effectively.
Que 87. Scenario: You need to load large data sets from both API and local DB efficiently. What approach will you take?
Answer:
- Use Repository Pattern to abstract data sources.
- Combine data sources using
LiveData
orFlow
. - Use Room database as a local cache and Paging 3 for efficient list rendering.
- Synchronize remote API calls with database updates.
Que 88. Scenario: Users complain about app loading slowly on startup. How would you diagnose and fix?
Answer:
- Use App Startup Library for optimized component initialization.
- Avoid heavy work in
onCreate()
of Application or MainActivity. - Load non-critical components lazily or asynchronously.
- Use
Profile GPU Rendering
orAndroid Studio Profiler
to detect bottlenecks.
Que 89. Scenario: Data updates in the ViewModel but UI does not reflect changes. What could be wrong?
Answer:
- Check if UI observes the correct LiveData or StateFlow instance.
- Ensure UI components are observing within their lifecycle.
- Confirm that data updates are posted correctly using
setValue()
orpostValue()
for LiveData.
Que 90. Scenario: You are asked to reduce your APK size. What techniques would you use?
Answer:
- Enable R8 code shrinking and resource shrinking.
- Use Android App Bundles to serve device-specific resources.
- Optimize image assets and remove unused libraries.
- Use ProGuard to obfuscate and remove unused code.

Also Check: Technical Interview Questions and Answers
Que 91. Scenario: API errors are not handled gracefully in the app. How will you improve this?
Answer:
- Use structured error handling using
try-catch
blocks around API calls. - Display user-friendly error messages via UI.
- Implement global error management in Retrofit interceptors.
- Log exceptions for debugging and analytics monitoring.
Que. 92 Scenario: Your app frequently crashes with OutOfMemoryError when loading high-resolution images from the gallery. How would you diagnose and resolve this?
Answer:
OutOfMemoryError (OOM) typically occurs due to bitmap allocations exceeding the heap size, especially on devices with limited RAM. To diagnose, use Android Profiler’s Memory tab to monitor allocations during image loading—capture heap dumps and analyze for large Bitmap objects using tools like MAT (Memory Analyzer Tool). Check logcat for GC messages or OOM stack traces.
To resolve, implement efficient image handling: Use libraries like Glide or Coil for automatic downsampling and caching. Decode bitmaps with BitmapFactory.Options: Set inSampleSize
to scale down (e.g., calculate based on required size). Use inJustDecodeBounds=true
first to get dimensions without allocating memory.
Example with BitmapFactory:
val options = BitmapFactory.Options().apply {
inJustDecodeBounds = true
BitmapFactory.decodeFile(filePath, this)
inSampleSize = calculateInSampleSize(this, reqWidth, reqHeight)
inJustDecodeBounds = false
}
val bitmap = BitmapFactory.decodeFile(filePath, options)
Recycle unused bitmaps with bitmap.recycle()
in onDestroy(). For RecyclerView galleries, use Paging to load incrementally. This reduces memory usage by 70-80% in image-heavy apps. Test on low-end emulators (e.g., 512MB heap) to verify.
Que. 93 Scenario: Users report that your app’s search functionality returns inconsistent results when the device is offline or has poor network. How would you improve data consistency?
Answer:
Inconsistent search results stem from hybrid data sources (local cache vs API) without proper synchronization. To improve, implement an offline-first architecture using Room for local storage and a sync mechanism with WorkManager to periodically fetch/update from API when online.
Use a Repository pattern: Query local DB first; if data is stale (e.g., based on timestamp), trigger a background sync. For search, use Room’s FTS (Full-Text Search) for efficient querying. Handle network states with ConnectivityManager to show cached results with a “Last updated” indicator.
Example Repository:
class SearchRepository(private val dao: SearchDao, private val api: ApiService) {
fun search(query: String): Flow<List<Result>> = flow {
emit(dao.search(query)) // Local first
if (isOnline()) {
val remote = api.search(query)
dao.insert(remote)
emit(remote)
}
}.flowOn(Dispatchers.IO)
}
Add conflict resolution (e.g., API overrides local). This ensures reliable UX, reducing user frustration in flaky networks.
Que. 94 Scenario: Your e-commerce app’s checkout process is slow due to multiple API calls for cart, payment, and user details. How would you optimize the backend integration?
Answer:
Slow checkout results from sequential API calls causing latency accumulation. Optimize by batching requests into a single GraphQL endpoint (if backend supports) or using composite API calls. For REST, use Retrofit with coroutines for parallel fetches via async/await.
Implement caching: Store non-sensitive data (e.g., user profile) in DataStore or Room with TTL. Use OkHttp’s caching for HTTP responses. Profile network with Charles/Flipper to identify bottlenecks.
Example parallel fetch with coroutines:
suspend fun loadCheckoutData(): CheckoutData = coroutineScope {
val cartJob = async { api.getCart() }
val paymentJob = async { api.getPaymentMethods() }
val userJob = async { api.getUserDetails() }
CheckoutData(cartJob.await(), paymentJob.await(), userJob.await())
}
Fallback to local cache on errors. This cuts load time by 40-60%, improving conversion rates.
Que. 95 Scenario: After updating to Android 14, your app’s custom notifications with images fail to display properly. What could be the cause and how to fix it?
Answer:
Android 14 introduces stricter foreground service requirements and notification changes, like requiring MEDIA_SESSION_SERVICE for media styles. If using RemoteViews for custom layouts, ensure compatibility with runtime permissions and Doze mode.
Cause: Possibly missing POST_NOTIFICATIONS permission or incorrect channel setup (importance HIGH for heads-up). Images may fail due to scoped storage restrictions on URI access.
Fix: Request Manifest.permission.POST_NOTIFICATIONS at runtime. Use NotificationCompat for backwards compatibility. For images, load via Bitmap and setLargeIcon().
Example:
val channel = NotificationChannel("id", "name", NotificationManager.IMPORTANCE_HIGH)
manager.createNotificationChannel(channel)
val notification = NotificationCompat.Builder(context, "id")
.setSmallIcon(R.drawable.ic_notify)
.setLargeIcon(BitmapFactory.decodeResource(resources, R.drawable.image))
.setContentTitle("Title")
.build()
manager.notify(1, notification)
Test on emulator with API 34. This resolves display issues while complying with new privacy rules.
Que. 96 Scenario: Your app experiences high crash rates on foldable devices during screen folding/unfolding. How would you handle multi-window and foldable support?
Answer:
Crashes on foldables often due to unhandled configuration changes (e.g., size/orientation) or lifecycle bugs. Use Jetpack WindowManager to detect folding states and adapt UI.
Handle: Override onConfigurationChanged() for custom logic, or use LifecycleObserver for fold events. Test with Foldable emulator in Android Studio.
Example with WindowManager:
val windowManager = WindowManager(context)
windowManager.windowManagerDelegate.addWindowLayoutInfoListener { info ->
if (info.displayFeatures.any { it is FoldingFeature && it.state == FoldingFeature.State.HALF_OPENED }) {
// Adapt UI for half-folded
adjustLayoutForFold()
}
}
Ensure fragments/activities are resizeable (android:resizeableActivity=”true” in manifest). This enhances UX on devices like Galaxy Fold, reducing crashes.
Que. 97 Scenario: The app’s database queries are slow, causing UI jank during scrolling in a list backed by Room. How would you optimize database performance?
Answer:
Slow queries result from unindexed columns, large transactions, or main-thread access. Optimize by adding @Index to entities, using paging with PagingSource for lists.
Run queries on IO dispatcher. Profile with Database Inspector or EXPLAIN QUERY PLAN in SQLite.
Example indexed entity:
@Entity(indices = [Index(value = ["name"], unique = true)])
data class User(
@PrimaryKey val id: Int,
val name: String
)
For lists: Use Pager with Room’s PagingSourceFactory. Batch inserts in transactions (@Transaction). This drops query time from seconds to ms.
Que. 98 Scenario: Users complain about app draining battery in the background after enabling location services. How would you investigate and mitigate?
Answer:
Background location can drain battery via frequent GPS wakes. Investigate with Battery Historian: ADB bugreport, analyze for wakelocks/alarms from your app.
Mitigate: Use FusedLocationProvider with balanced priority (PRIORITY_BALANCED_POWER_ACCURACY). Request BACKGROUND_LOCATION only if needed, with rationale. Use Geofencing for efficient triggers.
Example request:
locationRequest = LocationRequest.Builder(PRIORITY_LOW_POWER)
.setIntervalMillis(INTERVAL)
.build()
fusedLocationClient.requestLocationUpdates(locationRequest, callback, Looper.getMainLooper())
Remove updates in onPause(). Schedule with WorkManager for periodic checks. Reduces drain by 50-70%.
Que. 99 Scenario: During app review, Google Play rejects your app for violating data safety policies due to unnecessary permissions. How would you audit and minimize permissions?
Answer:
Rejections occur from over-requested permissions without justification. Audit: Review manifest for declared permissions, cross-check with features. Use PermissionChecker to runtime-request only essentials.
Minimize: Replace coarse permissions (e.g., ACCESS_FINE_LOCATION with ACCESS_COARSE_LOCATION if sufficient). Remove unused via lint checks (./gradlew lint).
Document in Play Console’s Data Safety form. For example, if camera not used, remove CAMERA. Test on API 33+ for granular media permissions.
This ensures compliance, building user trust.
Que. 100 Scenario: Your team needs to integrate A/B testing for UI variants in the app. How would you set up and analyze experiments using Firebase?
Answer:
Use Firebase Remote Config for parameter-based variants and A/B Testing for experiments. Set up: Define parameters (e.g., button_color), create experiment in console targeting users (e.g., 50% rollout), assign variants.
In code: Fetch config, apply values.
Firebase.remoteConfig.fetchAndActivate().addOnCompleteListener { task ->
if (task.isSuccessful) {
val color = Firebase.remoteConfig.getString("button_color")
button.setBackgroundColor(Color.parseColor(color))
}
}
Analyze in Firebase console: Metrics like retention, engagement. Use BigQuery export for custom analysis. Roll out winner. Advantages: No app updates needed, data-driven decisions. For seniors, integrate with Analytics for events.
Android Developer Interview Questions PDF
We have shared top android interview questions above, and we are also uploading a PDF to make it simpler for you.
FAQ: Android Developer Interview Questions
What is the job role of an Android Developer?
An Android Developer is responsible for creating, testing, and maintaining applications for Android devices. Their job involves writing clean and efficient code, designing user-friendly screens, integrating APIs, and fixing app issues to provide a smooth experience for users.
What technical skills are important for Android Developers?
Android Developers should know programming languages like Kotlin or Java, and tools like Android Studio. They should understand concepts like MVVM architecture, Jetpack libraries, UI design, databases (Room, SQLite), API integration (Retrofit), and background processing using WorkManager or coroutines.
What challenges do Android Developers face in their job?
Common challenges include handling app performance issues, solving memory leaks, dealing with different screen sizes and Android versions, managing background tasks efficiently, and keeping apps secure from threats.
What difficulties do candidates face during Android Developer interviews?
Many candidates struggle with scenario-based technical questions, explaining complex app architectures, and coding under pressure. Interviewers often check hands-on experience, problem-solving skills, and knowledge of modern Android development practices.
What is the average salary of Android Developers in the USA?
In the USA, entry-level Android Developers typically earn between $75,000 to $100,000 per year. Experienced developers or senior Android Developers can earn between $120,000 and $160,000 annually, depending on skills, certifications, and experience.
Which companies hire Android Developers?
Top companies hiring Android Developers include Google, Amazon, infosys, Meta, Microsoft, Accenture, Samsung, IBM, Uber, Spotify, Netflix, and many mobile app startups. E-commerce, finance, gaming, and healthcare industries also hire Android developers regularly.
Why is it important to prepare with Android interview questions?
Practicing interview questions helps you understand core concepts, recall solutions quickly, and explain your ideas clearly during interviews. It also improves your confidence and increases your chances of getting hired by top companies.
Conclusion
We have already shared a Most asked 100 Android Developer interview questions and answers covering technical topics, real-world scenarios, and advanced concepts like Jetpack Compose, dependency injection, and app optimization. These questions are designed to help you understand common interview patterns and improve your problem-solving skills.
For your convenience, we’ve also provided a PDF download, so you can easily revise these questions offline anytime. Review carefully, practice consistently, and you’ll feel more confident and prepared to clear your next Android Developer interview.
Also Check: