📱 250+ Android Interview Q&A 2026
Java & Kotlin · Beginner to Most Expert · Business Problems · AI/ML Trends · Real Code Labs
🌱 Beginner 60 Q&A
1. What is the Android Activity lifecycle? Why does a business app need to handle it correctly?
The lifecycle (onCreate → onStart → onResume → onPause → onStop → onDestroy) dictates when an activity is visible/invisible. Business impact: Releasing resources in onStop prevents memory leaks, crucial for video players, banking apps to save session state, avoid crashes.
2. Explain the difference between Java and Kotlin for Android development.
Kotlin is now Google’s preferred language: null safety, coroutines, extension functions, concise syntax. Java still used in legacy code. Businesses migrate for fewer crashes (null safety) and faster development.
3. How do you create a "Hello World" Android app?
Use Android Studio, create a new project, edit activity_main.xml with a TextView, set text in MainActivity. It compiles and runs on emulator/device.
4. What is the purpose of AndroidManifest.xml?
Declares app components (activities, services), permissions, hardware features, and application metadata. Essential for app installation and security.
5. How do you start a new Activity using Intent?
val intent = Intent(this, SecondActivity::class.java)
startActivity(intent) Explicit intents define target class. Implicit intents for actions like sending email.6. What's the difference between LinearLayout, RelativeLayout, and ConstraintLayout?
LinearLayout stacks children linearly; RelativeLayout positions relative to siblings/parent; ConstraintLayout uses flexible constraints, recommended for complex UIs. Business: ConstraintLayout reduces nesting, improves performance.
7. How to show a Toast message?
Toast.makeText(context, "Message", Toast.LENGTH_SHORT).show() Simple user feedback.8. What is a RecyclerView and why is it preferred over ListView?
RecyclerView efficiently recycles item views, supports different layout managers and animations. Essential for any list in modern apps like product catalogs.
9. How to handle button clicks in Android?
Use
findViewById and setOnClickListener, or with Kotlin synthetic imports / viewBinding. Business: submit orders, log in.10. What is the difference between Serializable and Parcelable?
Parcelable is Android-specific, faster, and uses less memory. Always prefer Parcelable for passing data between components (e.g., via intent). Kotlin's @Parcelize makes it easy.
11. How do you declare and request runtime permissions?
Check with
ContextCompat.checkSelfPermission, request with ActivityCompat.requestPermissions, handle callback. Critical for camera, location in delivery apps.12. What is a Fragment? When to use it?
Fragment is a reusable portion of UI inside an activity. Good for multi-pane layouts (tablets) and modular navigation. Business: reuse same order summary fragment across screens.
13. Explain the Fragment lifecycle and its relation to Activity lifecycle.
Fragments have their own lifecycle callbacks (onAttach, onCreateView, etc.). They are tied to host activity. Proper handling avoids crashes during configuration changes.
14. How to pass data between Activities?
Use Intent extras:
intent.putExtra("key", value). For complex objects use Parcelable. Business: pass product ID to detail screen.15. What is ViewBinding and DataBinding?
ViewBinding generates binding classes for XML layouts, eliminates findViewById. DataBinding allows binding data directly to views with expressions. Both improve code safety.
16. How to create an Options Menu in the app bar?
Override
onCreateOptionsMenu, inflate menu XML. Business: add search, settings icons.17. How to handle configuration changes like screen rotation?
Activity is recreated. Save state in
onSaveInstanceState Bundle, restore in onCreate. Or use ViewModel to retain data across config changes.18. What is a Service in Android? Give a business use-case.
Service runs background tasks without UI. Example: music playback, file download, or syncing inventory in a warehouse app.
19. How to schedule a task using AlarmManager?
AlarmManager triggers intents at specific times. Use for reminder notifications in a task management app.
20. What is SharedPreferences and when to use it?
Key-value storage for small primitive data like user settings, login token (not secure for sensitive data). Use for app preferences.
21. How to use Logcat for debugging?
Log.d(TAG, "message") outputs to Logcat window. Filter by tag. Essential for tracking API responses and errors.
22. What is the Gradle build system? Explain the difference between build.gradle (project) and build.gradle (app).
Gradle manages dependencies, build configurations. Project-level configures repositories; app-level defines SDK versions, dependencies, signing.
23. How to add a dependency in an Android project?
Add implementation line in app/build.gradle dependencies block, e.g.,
implementation 'androidx.core:core-ktx:1.12.0', then sync.24. What is an APK and how to generate a signed APK?
APK is the Android application package. Use Build > Generate Signed Bundle/APK. A release APK must be signed with a keystore for distribution.
25. How to implement a simple SQLite database using Room?
Define @Entity, @Dao, @Database. Room abstracts SQLite, provides compile-time verification. Use for offline caching of product data.
26. Explain the purpose of AndroidX.
AndroidX is the improved, modular replacement for the old Support Library. Ensures backward compatibility and frequent updates. All new projects should use AndroidX.
27. How to use an ImageView to load an image from resources?
imageView.setImageResource(R.drawable.ic_logo) in Java/Kotlin, or via XML src attribute.28. What is the difference between match_parent and wrap_content?
match_parent: fills available space; wrap_content: sizes to content. Used in layout params.
29. How to create a simple animation with ObjectAnimator?
ObjectAnimator.ofFloat(view, "translationY", 0f, 100f).start(). Great for subtle UI feedback.
30. What is the Android Context? Why is it important?
Context is an interface to global information about an application environment. Used for accessing resources, starting activities, creating views. Avoid memory leaks by not holding Activity context beyond lifecycle.
31. How to detect network connectivity?
Use ConnectivityManager and NetworkCapabilities. Show offline message in e-commerce app.
32. What is a ContentProvider? When would a business use it?
ContentProvider shares data between apps securely. Example: sharing inventory data with a partner app, or accessing contacts.
33. How to read a JSON file from assets folder?
Open InputStream with assetManager.open("file.json"), read and parse. Used for local configs.
34. What is the difference between a Vector Drawable and a PNG?
Vector Drawables are scalable, smaller in size, good for icons. PNG is raster. Use vectors for crispness on all screens.
35. How to handle the back button press?
Override onBackPressed() or use OnBackPressedDispatcher. Control navigation flow; prevent accidental exit in form screens.
36. What are the basic UI components: TextView, EditText, Button, CheckBox?
TextView displays text, EditText input, Button clickable, CheckBox selectable boolean. Foundational for forms.
37. How to use a ProgressBar to indicate loading?
Show ProgressBar before API call, hide on response. Business: improve UX during payment processing.
38. What is the difference between dp, sp, and px?
dp (density-independent pixels) for layouts, sp for text scaling, px is physical pixels. Using dp ensures UI consistency across devices.
39. How to implement a simple login form with validation?
Use TextInputLayout with EditText, validate fields before API call. Business: authenticate users securely.
40. What is an AsyncTask and why is it deprecated?
AsyncTask performed background operations but caused memory leaks, lifecycle issues. Replaced by coroutines (Kotlin) or RxJava.
41. How to run a task in the background using Kotlin coroutines?
lifecycleScope.launch {
withContext(Dispatchers.IO) { /* network call */ }
// update UI on Main
} Structured concurrency.42. What are the common Android SDK versions and the minSdkVersion?
minSdkVersion defines the lowest Android version supported. Businesses balance reach vs modern features; typical minSdk 21 or 23.
43. How to use a SeekBar for user input (e.g., rating)?
SeekBar allows selecting a value from a range. Use OnSeekBarChangeListener. Example: adjusting loan amount.
44. What is the R class in Android?
Auto-generated class that contains resource IDs. Used to reference layouts, drawables, strings.
45. How to add a Splash Screen in Android 12+?
Use the SplashScreen API or define a theme with windowBackground. Branding and reduce cold start time.
46. Explain the concept of Intent Filters.
Declare in manifest which intents an activity can respond to (e.g., VIEW, SEND). Enables deep linking and app sharing.
47. How to use Snackbar instead of Toast?
Snackbar provides action button and swipe-to-dismiss. Better for undo actions in a note-taking app.
48. What is the difference between compileSdkVersion and targetSdkVersion?
compileSdk: version against which app is compiled. targetSdk: indicates which API level app is tested for; affects runtime behavior.
49. How to create a simple ListView using ArrayAdapter?
Set adapter with a list of strings. Basic but not performant for large data; use RecyclerView.
50. How to use the Android Emulator for testing?
Create AVD with desired API level, run app. Simulate GPS, calls, network speed. Essential for initial testing.
51. What is proguard/R8 and why minify?
Shrinks, obfuscates, optimizes code. Reduces APK size and makes reverse engineering harder. Business: protect intellectual property.
52. How to implement a broadcast receiver for battery low?
Register BroadcastReceiver for ACTION_BATTERY_LOW. Adjust background work to save power in a logistics app.
53. How to use a WebView to display a webpage inside the app?
WebView.loadUrl("https://..."). Enable JavaScript if needed. Common for displaying privacy policy or payment gateways.
54. What is the Android KTX?
Set of Kotlin extensions that simplify Android API calls. E.g., sharedPreferences.edit { putString(...) }.
55. How to handle multilanguage support with strings.xml?
Create values- folders with strings.xml translations. Business: global user base.
56. What are the basic Git commands for an Android project?
git init, add, commit, push. Version control essential for team collaboration.
57. How to create a custom theme for your app?
Define styles in themes.xml, apply in manifest or per activity. Consistent branding increases trust.
58. How to use a CheckBox and get its state?
checkbox.isChecked. Use in to-do list apps.
59. What is the use of @SuppressLint?
Suppresses lint warnings. Use sparingly, but sometimes needed for legacy code.
60. How to use a DatePickerDialog?
Show DatePickerDialog, set listener to get selected date. Common in booking systems.
⚡ Intermediate 80 Q&A
61. Explain MVVM architecture with Android components.
Model (data), View (Activity/Fragment), ViewModel (holds UI state, survives config changes). Uses LiveData/StateFlow for observation. Business: testable, separation of concerns.
62. How to implement Room database with DAO and entities?
Define @Entity data class, @Dao interface with CRUD operations, @Database abstract class. Provides compile-time SQL verification. Use with coroutines for async queries.
63. What is the difference between LiveData and StateFlow?
LiveData is lifecycle-aware but limited to Android; StateFlow is Kotlin-native, supports operators, and can be used in pure Kotlin modules. For new apps, prefer StateFlow with coroutines.
64. How to perform network requests using Retrofit?
Define interface with @GET, @POST, etc., create Retrofit instance with base URL and converter (Gson/Moshi). Business: fetch product catalog.
65. Explain Kotlin coroutines: launch, async, runBlocking.
launch for fire-and-forget, async returns Deferred result, runBlocking blocks thread (testing). Use structured concurrency with scopes.
66. How to handle error handling in Retrofit with coroutines?
Wrap call in try-catch, check for HttpException. Use a sealed class Result wrapper for success/error. Provide user-friendly messages.
67. What is Dependency Injection (DI) and how does Dagger/Hilt help?
DI provides dependencies rather than creating them directly, improving testability. Hilt (built on Dagger) simplifies DI in Android with @HiltAndroidApp, @Inject, @Module.
68. How to implement navigation using Jetpack Navigation component?
Define navigation graph XML, use NavController to navigate, safe args for passing data. Handles fragment transactions and back stack.
69. How to use ViewModel with SavedStateHandle for process death?
SavedStateHandle persists data across process recreation. Use it to save UI state like search query. Business: seamless user experience after app killed.
70. What is WorkManager and when to use it instead of Service?
WorkManager for deferrable, guaranteed background work (sync, upload). Supports constraints like network. Replaces JobScheduler and Firebase JobDispatcher. Example: daily inventory sync.
71. How to implement pagination in RecyclerView with Jetpack Paging 3?
Use PagingSource to load pages from API or DB, PagingDataAdapter in RecyclerView. Handles loading states automatically. Ideal for infinite feeds.
72. Explain the difference between ConstraintLayout and Compose layout system.
ConstraintLayout is XML-based, flexible; Compose uses declarative Kotlin code. Compose is modern, reactive, but both can be used. Business: Compose reduces UI code by up to 40%.
73. How to use Kotlin Flow for reactive streams?
Flow is a cold stream; use .collect or StateFlow for state. Excellent for real-time data updates like chat or stock prices.
74. How to implement a local database with Room and keep it in sync with remote API?
Repository pattern: fetch from network, save to Room, expose data from Room via Flow. Offline-first: Room as single source of truth.
75. What is the role of a Repository in MVVM?
Repository abstracts data sources (local/remote). ViewModel doesn't know where data comes from. Business: swap mock data for real API easily.
76. How to handle configuration changes with ViewModel and LiveData?
ViewModel survives rotation, LiveData holds latest value. Re-observe in new activity instance. No manual state restoration needed.
77. How to implement biometric authentication using BiometricPrompt?
Check biometric availability, show BiometricPrompt, handle success/failure. Business: secure banking app login.
78. What are the advantages of using Kotlin extension functions in Android?
Add functionality to existing classes without inheritance. e.g., hideKeyboard() extension on Activity. Cleaner code.
79. How to use DataStore instead of SharedPreferences?
DataStore is async, uses Kotlin coroutines and Flow, supports typed data. Better for app settings.
80. How to implement deep linking in Android?
Define intent filters in manifest with scheme/host/path. Handle in Activity with intent.data. Used for marketing campaigns to open specific product page.
81. How to use CameraX for a custom camera feature?
CameraX simplifies camera usage. Bind use cases (preview, image capture) to lifecycle. Example: document scanner in logistics.
82. How to implement push notifications with Firebase Cloud Messaging (FCM)?
Add firebase-messaging dependency, extend FirebaseMessagingService, get token. Handle data payload to navigate. Business: order status updates.
83. What is the difference between a Service and an IntentService?
IntentService runs on a worker thread and stops itself. Service runs on main thread unless a worker thread is created. Both are deprecated; use WorkManager or coroutines.
84. How to use Kotlin's sealed class for API response handling?
Define sealed class Result with Success, Error, Loading subclasses. Pattern match with when. Clean error handling in ViewModel.
85. How to implement a bottom navigation bar with fragments?
Use BottomNavigationView with Navigation component: setup menu items, connect with navController. Each tab has its own fragment.
86. How to use Android Architecture Components together: ViewModel, LiveData, Room, Repository.
Room DAO returns LiveData/Flow, Repository exposes it, ViewModel transforms and provides to UI. A standard, recommended stack.
87. What is the purpose of the @JvmStatic annotation in Kotlin?
Exposes a companion object method as a static method for Java interop. Used in Android when Java code calls Kotlin.
88. How to handle file upload with Retrofit and multipart?
Use @Multipart and @Part with MultipartBody.Part. Track progress with custom RequestBody. Common in document sharing apps.
89. Explain the use of the Android KTX for shared preferences.
preferences.edit { putString("key", "value") } concise and coroutine-friendly.90. How to implement a custom view by extending an existing View?
Override onDraw, use canvas. Example: circular progress bar. Business: brand-specific UI.
91. What are the different types of tests in Android: unit, integration, UI (Espresso)?
Unit tests verify logic (JUnit, Mockito). Integration tests test components together. UI tests simulate user interaction with Espresso.
92. How to use Mockito or MockK for unit testing ViewModels?
Mock dependencies (Repository), verify interactions. Kotlin prefers MockK for coroutine support. Business: ensure login logic works.
93. How to test Room database using an in-memory database?
Create Room.inMemoryDatabaseBuilder in test. Verify DAO operations. Fast, isolated.
94. How to use Espresso for UI testing?
onView(withId(R.id.button)).perform(click()). Check if text appears. Used for critical user journeys like checkout.
95. How to implement a ViewPager2 with fragments?
Use FragmentStateAdapter with ViewPager2. Swipeable pages, e.g., onboarding.
96. How to handle keyboard visibility and adjust layout?
Use windowSoftInputMode="adjustResize" in manifest, or detect with WindowInsets. Ensure input fields are not hidden.
97. What is the difference between AndroidX and Jetpack?
AndroidX is the package namespace; Jetpack is a suite of libraries (including AndroidX) that provide best practices, reduce boilerplate.
98. How to implement a search feature with debounce using Kotlin Flow?
Use debounce operator on Flow from EditText changes. Avoid excessive API calls.
99. How to use the Google Maps SDK in an Android app?
Add Maps SDK, get API key, SupportMapFragment, add markers. Business: store locator.
100. How to implement in-app purchases with Billing Library?
Integrate Play Billing Library, query products, launch billing flow, verify purchase. Critical for subscription apps.
101. What are the different launch modes for Activity?
standard, singleTop, singleTask, singleInstance. singleTask used for main entry point to avoid multiple instances.
102. How to secure sensitive data using EncryptedSharedPreferences?
Use EncryptedSharedPreferences from AndroidX Security. Store tokens, passwords securely.
103. Explain the concept of "Single Source of Truth" in repository pattern.
Local database is the single source; network data is written to DB, then observed. Ensures consistency offline/online.
104. How to use the NotificationManager to show a heads-up notification?
Create NotificationChannel (Oreo+), build notification with setPriority high. Example: incoming call.
105. How to implement a RecyclerView with multiple view types?
Override getItemViewType, create different ViewHolders. Business: chat screen with text, image, and video items.
106. How to perform background network sync with WorkManager and Retrofit?
Create a Worker that calls API with Retrofit, handle constraints (network). Periodic work for inventory sync.
107. How to use the Android Profiler for performance analysis?
Monitor CPU, memory, network. Identify memory leaks, slow methods. Business: ensure smooth scrolling in product list.
108. What is the difference between ViewModel and AndroidViewModel?
AndroidViewModel has Application context, useful for resources. But use with caution to avoid memory leaks; prefer plain ViewModel with DI.
109. How to handle runtime permission for location in a delivery app?
Check for ACCESS_FINE_LOCATION, request if denied, show rationale, handle "never ask again" with settings intent.
110. How to implement a dark theme using DayNight?
Use AppCompatDelegate.setDefaultNightMode, define themes in values-night. Respect system setting. Business: reduce eye strain.
111. How to use MotionLayout for complex animations?
Define MotionScene XML, transitions between ConstraintSets. Animate onboarding or checkout flow.
112. How to handle app updates programmatically using In-App Updates API?
Check for update availability, start immediate or flexible flow. Business: ensure users have latest version.
113. What is the difference between Kotlin's `let`, `apply`, `run`, `also`?
Scope functions: let for transformations, apply for object configuration, run for computing result, also for side effects.
114. How to use the Android NDK for performance-critical code?
Write C/C++ code, build with CMake, call via JNI. Example: image processing for real-time filter app.
115. How to implement a custom Gson TypeAdapter for complex JSON parsing?
Register TypeAdapter with GsonBuilder. Handles tricky date formats or polymorphic deserialization.
116. How to use the Kotlin Serialization library instead of Gson?
Add kotlinx-serialization, annotate data class with @Serializable. Compile-time safe, faster. Modern alternative.
117. How to implement a countdown timer using Kotlin coroutines?
Use flow { while (time > 0) { emit(time); delay(1000); time-- } }. Business: OTP resend timer.
118. What are the key differences between RxJava and Kotlin Flow?
Flow is lightweight, coroutine-based, integrated with structured concurrency. RxJava has a steeper learning curve but huge operator set. For new projects, Flow is recommended.
119. How to handle multiple network requests sequentially and in parallel using coroutines?
Sequential: two consecutive await() calls. Parallel: async inside coroutineScope { } then awaitAll. Example: fetch user + orders simultaneously.
120. How to use the Navigation Safe Args plugin for type-safe argument passing?
Add plugin to build.gradle, define arguments in nav graph, generated classes prevent key errors.
121. What is the use of the @InstallIn annotation in Hilt?
Specifies where to install the module (e.g., SingletonComponent, ViewModelComponent). Controls scope.
122. How to write a custom Gradle plugin to manage app versions?
Implement Plugin, define extension, apply in build.gradle. Automates versionName from git tags.
123. How to implement a location tracking service with foreground service and notification?
Start foreground service with ongoing notification, request location updates from FusedLocationProvider. Important for fitness apps.
124. How to handle multi-module project with dynamic feature modules?
Use Android App Bundles, dynamic feature modules for on-demand delivery. Reduces initial install size. Example: optional AR feature.
125. How to test a Room DAO with Coroutines?
Use runTest or runBlocking, provide an in-memory database. Verify insert and query.
126. What is the difference between `suspend` and `launch` in coroutines?
suspend function pauses coroutine without blocking thread, must be called from coroutine. launch starts a new coroutine.
127. How to use Android's Result API for activity results (replace startActivityForResult)?
registerForActivityResult with contract. Cleaner, type-safe.
128. How to implement a custom transition animation between activities?
Use ActivityOptions.makeCustomAnimation or override pending transitions. Enhance user experience.
129. How to use the MediaPlayer for audio playback with state management?
Manage prepare, start, pause, release. Use service for background playback. Business: podcast app.
130. How to handle Android App Links (verified deep links)?
Host assetlinks.json on website, declare autoVerify in manifest. Opens app directly without chooser. Excellent for marketing campaigns.
131. How to use the ExoPlayer for video streaming?
ExoPlayer is Google's media player, supports DASH, HLS. Replace MediaPlayer for advanced features.
132. How to implement a swipe-to-delete in RecyclerView with ItemTouchHelper?
SimpleCallback with onSwiped, remove item, show Snackbar for undo. Business: email app.
133. How to use the Data Binding Library with Observable fields?
Make fields ObservableBoolean, etc., bind in XML. Automatically updates UI when data changes. Reduces boilerplate.
134. How to use the LocalBroadcastManager for in-app communication?
Deprecated. Use LiveData, EventBus, or shared ViewModel scoped to activity.
135. How to handle file access with the Storage Access Framework (SAF)?
Use Intent ACTION_OPEN_DOCUMENT, get URI, take persistable permission. Business: attach file to email.
136. How to use the Android Keystore system for storing cryptographic keys?
Generate key pair in KeyStore, use for encryption. Protects sensitive data like payment info.
137. How to implement a custom toolbar with search view?
Set Toolbar as ActionBar, inflate menu with SearchView, implement query listener. Common in product search.
138. How to handle the lifecycle of a coroutine scope in ViewModel?
Use viewModelScope, automatically cancelled when ViewModel cleared. Prevents memory leaks.
139. How to use the Jetpack Compose in an existing XML-based project?
Add Compose dependencies, use ComposeView in XML layout. Gradually migrate screens. Business: adopt modern UI incrementally.
140. How to implement a simple chat UI with RecyclerView and keyboard handling?
Reverse layout, adjust insets for keyboard, scroll to bottom on new message. Use EditText at bottom.
🧠 Expert 80 Q&A
141. Explain the internal working of Jetpack Compose: how recomposition works.
Compose tracks state reads, only recomposes affected composables. Uses a slot table and gap buffer. Smart recomposition skips unchanged parts. Business: performant dynamic UIs like real-time dashboards.
142. How to build a custom Compose layout with custom measurement?
Implement Layout composable, override measure policy with measurables. Example: staggered grid. Understand intrinsic measurements.
143. How to integrate TensorFlow Lite for on-device image classification in an inventory app?
Use TensorFlow Lite Android Support Library, load model, process bitmap, run inference. Identify products offline. Reduce server costs.
144. How to use ML Kit for barcode scanning in a logistics app?
Use BarcodeScanning from ML Kit, process camera frames, decode. Instant package tracking.
145. Design a Clean Architecture for a large Android project with multiple modules.
Domain (use cases, models), Data (repositories, data sources), Presentation (ViewModels, UI). Gradle modules enforce dependency rules. Business: scalability, testability.
146. How to implement a custom Gradle plugin to enforce architecture rules?
Write plugin that uses ArchUnit or custom checks to prevent direct imports from presentation to data. Fails build on violation. Maintains clean architecture in large teams.
147. How to perform advanced custom view with Canvas and Path?
Override onDraw, use Path for complex shapes, Paint with shaders. Example: a custom graph widget for financial app.
148. How to use the Android NDK with C++ for real-time audio processing?
Use Oboe library, C++ code, JNI bridge. Low latency audio for communication apps.
149. How to implement a reactive state management with Kotlin Flow and sealed classes in complex UI?
Define ViewState sealed class with Loading, Success, Error, etc. Use StateFlow in ViewModel, collect in Compose or fragments. Unidirectional data flow.
150. How to handle deep performance optimization: memory leaks, jank, and overdraw?
Use Android Profiler, LeakCanary. Reduce overdraw by removing unnecessary backgrounds, use ConstraintLayout, avoid allocations in onDraw. Business: smooth user experience.
151. How to implement a multi-module project with dynamic feature modules and on-demand delivery?
Use Android App Bundles, define feature modules, request install via Play Core. Example: AR try-on feature installed only when needed.
152. How to implement a plugin system for a white-label app where clients can extend functionality?
Use a service locator, define extension points, load implementations from separate APK/AARs. Complex but enables customization for different business clients.
153. How to integrate a chatbot using Dialogflow or a custom NLP model on-device?
Use Dialogflow SDK or tensorflow lite model for NLP. Offline chatbot for customer support reduces API calls.
154. How to implement AR features using ARCore and Sceneform (deprecated) or filament?
Use ARCore for plane detection, place 3D models. Business: furniture visualization in retail.
155. How to handle app security with certificate pinning and code obfuscation?
OkHttp certificate pinner, proguard/R8 rules, use DexGuard for advanced obfuscation. Protect financial apps.
156. How to build a custom ViewModel factory with Dagger/Hilt and SavedStateHandle?
Use @ViewModelInject in Hilt, or AssistedInject with Dagger. Ensures dependencies and saved state handle are provided. Example: user profile with userId from args.
157. How to implement an offline-first sync with conflict resolution using CRDT?
Implement CRDT library, track changes, merge with server. Used in collaborative note-taking app. Complex but ensures consistency.
158. How to use the Android GPU Inspector for graphics profiling?
Analyze GPU usage, optimize shaders for custom views or OpenGL ES. For game-like apps.
159. How to create a custom lint rule using the Lint API?
Extend Detector, implement Issue, register in a LintRegistry. Enforce naming conventions, missing annotations. Business: maintain code quality.
160. How to implement a background task with periodic sync using WorkManager and unique work?
Use enqueueUniquePeriodicWork with KEEP policy. Example: sync every 6 hours, only one instance running.
161. How to use the Kotlin Symbol Processing (KSP) for annotation processing?
KSP is faster than kapt. Write a SymbolProcessor to generate code at compile time. For custom serialization, DI, etc.
162. How to test Compose UI with Compose testing library?
Use createComposeRule, onNodeWithTag, performClick, assertIsDisplayed. Simulate user interaction.
163. How to handle dependency injection in a multi-module project with Hilt?
Use @Module with @InstallIn to provide dependencies per module. Component dependencies are managed. Feature modules can have their own DI modules.
164. How to implement a secure local database with SQLCipher?
Use Room with SQLCipher support. Encrypt database file. Protect sensitive user data like health records.
165. How to use Protocol Buffers (protobuf) instead of JSON for network communication?
Smaller payload, faster serialization. Use protobuf-gradle-plugin, Retrofit converter. Great for high-frequency IoT apps.
166. How to build a real-time collaboration feature (like Google Docs) using Operational Transformation or CRDT?
Use WebSocket, OT/CRDT algorithm, reconcile remote changes. Complex but doable with a library or custom implementation.
167. How to implement a custom camera with manual focus and exposure using Camera2 API?
Camera2 provides fine control. Use CaptureRequest for manual settings. Business: document scanning with specific lighting.
168. How to use Kotlin Multiplatform (KMP) to share business logic between Android and iOS?
Extract domain and data layers to shared Kotlin module. Use expect/actual for platform specifics. Reduces duplication.
169. How to profile and reduce APK size effectively?
Analyze with Android Studio APK Analyzer. Use App Bundle, remove unused resources (shrinkResources), proguard, reduce native libs by ABI splits, use vector drawables, compress images.
170. How to handle large data sets in a RecyclerView with DiffUtil and AsyncListDiffer?
DiffUtil calculates changes on background thread, AsyncListDiffer applies them efficiently. Smooth animations even with 10k+ items.
171. How to implement a custom ViewGroup with complex layout logic?
Extend ViewGroup, override onMeasure and onLayout. Example: a flow layout that wraps items.
172. How to use the AndroidX Startup library to optimize app initialization?
Define initializers with dependencies, avoid cold start delays. Business: faster app launch for e-commerce.
173. How to handle multiple back stacks with Navigation component?
Use NavigationUI with BottomNavigationView and setupWithNavController for multiple back stacks (available since 2.4.0). Each tab retains its own stack.
174. How to implement a gradient animation on a custom view using ValueAnimator?
Animate a property, invalidate view. Use LinearGradient shader with animated coordinates. Eye-catching branding.
175. How to use the Android automotive OS for a car companion app?
Extend to Android Auto with Car App Library, design for driver distraction. Business: fuel payment app on car screen.
176. How to implement a custom streaming music player with ExoPlayer and MediaSession?
Connect ExoPlayer to MediaSession, handle audio focus, show notification with playback controls. Business: music streaming service.
177. How to perform A/B testing with Firebase Remote Config and Analytics?
Configure A/B test in Firebase console, fetch values in app, vary UI/features. Measure conversion impact.
178. How to implement a chat app with end-to-end encryption using Signal Protocol?
Integrate libsignal, manage keys, encrypt messages before sending. Advanced security for messaging.
179. How to use the Android Neural Networks API (NNAPI) for on-device ML acceleration?
TensorFlow Lite delegates to NNAPI for hardware acceleration. Improve inference speed in image recognition.
180. How to design a scalable notification system handling different types (push, local, in-app)?
Unified notification manager, channel configuration, grouping. Use FCM for push, AlarmManager for reminders. Prioritize based on business rules.
181. How to implement a pixel-perfect UI matching design specs across different screen densities?
Use dp, sp, density qualifiers for drawables. Preview in multiple layouts. Ensure consistency with designer tools.
182. How to integrate a third-party SDK that uses old OkHttp version causing conflicts?
Exclude transitive dependency, force version alignment, or isolate SDK in a separate process.
183. How to use the WindowManager for floating widgets (bubbles) like chat heads?
Use WindowManager with TYPE_APPLICATION_OVERLAY permission (Android 10+ restrictions). Provide value-add feature.
184. How to implement a custom rating bar with half-star precision and animations?
Custom View with onTouchEvent, draw stars using Canvas, animate with ValueAnimator. Business: product reviews.
185. How to handle edge-to-edge display and system bars insets in modern Android?
Use WindowInsets API, set fitsSystemWindows or handle in Compose with Modifier.windowInsetsPadding. Full-screen experience.
186. How to build a CI/CD pipeline with GitHub Actions for Android: testing, building, distributing to Firebase App Distribution?
Define workflow, run lint, unit tests, build APK/AAB, upload to Firebase. Automate release process.
187. How to use the Android Debug Database to inspect Room and SharedPreferences?
Add library, open browser to see database in real-time during development. No root needed. Helps debugging.
188. How to handle compatibility issues between different Android versions (API levels)?
Use version checks (Build.VERSION.SDK_INT), AndroidX backward compatibility, test on multiple devices/emulators. Business: wide market reach.
189. How to create a custom Drawable with states (pressed, focused)?
Extend Drawable, override onStateChange. Example: custom button background with water ripple.
190. How to use the Android Renderscript (deprecated) or Vulkan for compute tasks?
Renderscript deprecated; use Vulkan compute or OpenCL via NDK for heavy parallel computation like image filtering.
191. How to implement a staggered animation with multiple views using Interpolators?
Apply different start delays with ObjectAnimator and play together in AnimatorSet. Engaging onboarding.
192. How to test a WorkManager worker?
Use WorkManagerTestInitHelper, enqueue and check result. Mock dependencies. Verify sync logic.
193. How to implement a custom Gradle task to generate version code from git commits count?
Write a task that runs git command, parse output, set versionCode. Auto-increments builds.
194. How to use the Android System Tracing (Perfetto) for advanced performance analysis?
Add custom trace events, capture with Perfetto, analyze app startup and jank. Very detailed.
195. How to handle a large codebase migration from Java to Kotlin incrementally?
Use Java-to-Kotlin converter, keep interop smooth, write new features in Kotlin, gradually rewrite critical parts. Ensure no regression.
196. How to implement an adaptive layout that works on phone, tablet, and foldable?
Use WindowSizeClass, provide different layouts (list-detail). Jetpack Compose makes this easier. Business: productivity app.
197. How to secure network requests with SSL pinning using OkHttp?
Add CertificatePinner with hash pins. Prevents MITM attacks. Banking apps must do this.
198. How to use the Jetpack Macrobenchmark library to measure app startup and scrolling performance?
Write benchmark rule, trace sections, run on device. Compare before/after optimizations.
199. How to implement a custom View with touch handling for a signature pad?
Track MotionEvents, draw paths on Canvas. Save to bitmap. Business: delivery confirmation.
200. How to handle multi-threading with ThreadPoolExecutor vs coroutines?
Coroutines are preferred for async tasks, lightweight. Use thread pools for CPU-intensive work via Dispatchers.Default (which uses a thread pool).
201. How to create a custom pluggable architecture with ServiceLoader in Android?
Define interface, implementations in META-INF/services, load at runtime. Can be used to swap analytics providers.
202. How to use the Android TelephonyManager to read SIM card info for fraud detection?
Requires permission, retrieve IMEI/IMSI (restricted). Used in banking to verify device binding.
203. How to build a video conferencing app using WebRTC on Android?
Integrate Google's WebRTC library, manage PeerConnection, signaling server. Complex but full control.
204. How to handle accessibility (TalkBack) in custom views and Compose?
Set contentDescription, implement accessibility delegates, test with screen reader. Inclusive design mandatory for government apps.
205. How to implement a custom Activity transition that morphs a view into another?
Use ActivityOptions.makeSceneTransitionAnimation with shared element. Provide smooth navigation from list to detail.
206. How to reduce the cold start time of the app using baseline profiles?
Generate baseline profile via Macrobenchmark, include in app. ART optimizes ahead-of-time compilation for key user journeys.
207. How to integrate an AI image generator (like Stable Diffusion) using on-device ML?
Use a compressed TFLite model, run inference in background. Limited by device capabilities but possible for smaller models.
208. How to use the Android Graphics Shading Language (AGSL) for custom shaders?
Use RuntimeShader with custom shader code in Compose or custom View. Create stunning visual effects.
209. How to implement a sophisticated search with voice input using SpeechRecognizer?
Use SpeechRecognizer API or Google Assistant integration. Convert speech to text, trigger search. Hands-free operation.
210. How to handle large file downloads with DownloadManager or custom implementation with pause/resume?
DownloadManager handles system download queue. Custom using OkHttp with Range header supports pause. Business: offline maps.
211. How to create a dynamic feature module that can be updated independently via Play Core?
Use Play Feature Delivery, module can be updated without full app update. Good for frequently changing content.
212. How to handle app shortcuts (static and dynamic) for quick actions?
Use ShortcutManager, define shortcuts in XML or dynamically. Business: "New Order" shortcut for sales app.
213. How to use the Android Keystore for generating an HMAC for API request signing?
Generate key in Keystore, sign request body. Prevents tampering in financial transactions.
214. How to implement a custom lint check that prevents usage of Log in release builds?
Create Detector for MethodCall on Log class, report error. Enforce using Timber or custom logger.
215. How to use the Android Backup and Restore API for app data?
Auto backup for shared preferences and databases, but limited. Implement BackupAgent for custom logic. Helps user data migration.
216. How to create a custom spinner (dropdown) with search filter functionality?
Use an Exposed Dropdown Menu in Material, or custom PopupWindow with EditText for search. Business: country selection.
217. How to handle orientation lock for specific screens (e.g., video player) while allowing rotation elsewhere?
Set requestedOrientation in Activity or via Compose with LocalContext. Lock to landscape for video, free otherwise.
218. How to use the `AndroidHiddenApiBypass` to access hidden APIs (not recommended)?
Reflection tricks; not allowed on Google Play. Avoid, use public APIs. Mentioned for knowledge only.
219. How to implement a custom calendar view with event indicators?
Extend View, draw grid of days, highlight dates with dots. Complex but full control. Business: booking app.
220. How to integrate a fraud detection SDK with real-time device risk assessment?
Collect device fingerprints, send to backend, receive risk score. Used in financial onboarding.
👑 Most Expert 40 Q&A
221. How would you modify the Android framework to add a new system service for custom hardware?
Requires building AOSP, adding AIDL, service implementation, registering with ServiceManager. Used in custom embedded devices.
222. How to design a multi-process app for a music player with a separate player process?
Declare process in manifest for service, use IPC (Messenger, AIDL) to communicate. Music continues if UI process dies.
223. How to implement a custom View that renders a large graph with thousands of nodes using OpenGL ES?
Use GLSurfaceView, write vertex/fragment shaders, batch draw calls. Smooth performance for network visualization.
224. How to use the Android Runtime (ART) profile guided optimization (PGO) to improve app performance?
Collect profiles with Macrobenchmark, ship baseline.prof for critical paths. ART pre-compiles those methods.
225. How to build a custom annotation processor with KSP to generate complex Dagger modules?
Use KSP to read annotations, generate Kotlin source files. Automate repetitive DI setup.
226. How to implement a real-time video streaming app with WebRTC and a custom SFU/MCU?
Deep WebRTC internals, custom signaling, media negotiation. Scalable for many participants.
227. How to run an LLM (like LLaMA) on Android using llama.cpp and JNI?
Compile llama.cpp with NDK, call via JNI from Kotlin. Manage memory, run inference on separate thread. Cutting-edge on-device AI.
228. How to use the Android Virtualization Framework (AVF) to run isolated workloads?
For highly sensitive operations, like DRM or secure payments. Leverages pKVM. Very specialized.
229. How to design a modular architecture that supports hot-swapping features at runtime without app restart?
Use a plugin system with class loaders, dynamic feature modules can be loaded on demand, not truly hot-swap in production due to Play Store restrictions. Explore for internal enterprise apps.
230. How to implement a distributed tracing client (OpenTelemetry) in Android?
Integrate with OpenTelemetry SDK, propagate trace context to backend. Correlate client and server latency for complete picture.
231. How to create a custom renderscript replacement using Vulkan compute shaders for image processing?
Write GLSL compute shaders, compile to SPIR-V, execute on GPU. Much faster than CPU for filters. Use with Android's Vulkan API.
232. How to implement an efficient disk cache with LRU eviction for offline content?
Use DiskLruCache, manage file size limits. Good for image caching in a custom image loader.
233. How to design a real-time multiplayer game using Android with client prediction and server reconciliation?
Implement authoritative server, client-side prediction, lag compensation. Use UDP for speed. Very advanced for a mobile game.
234. How to use the Android Protected Confirmation to verify critical transactions?
Shows a trusted UI on a secure hardware path, user confirms. Prevents malware tampering. Banking apps use it.
235. How to optimize an app that continuously processes camera frames for object detection with minimal battery drain?
Use CameraX with analysis, set backpressure strategy, use NNAPI delegate, throttle detection, run at lower resolution when not needed. Crucial for long-running AR apps.
236. How to implement a custom resource loading mechanism for dynamic theming (swap drawables at runtime)?
Override Resources, load from a custom path. Theme engine for white-label apps.
237. How to debug and fix a memory leak caused by a static reference to an Activity?
Use WeakReference, LeakCanary to detect. Ensure static handlers are cleaned up. Replace with ViewModel.
238. How to implement a custom garbage collector for native memory in Android NDK?
Manage native allocations manually, use finalizers or a custom memory pool. Extremely advanced.
239. How to use the Android DEX layout optimization (Profile Guided Optimization for DEX)?
Baseline profile also affects DEX layout; reduces app startup. Profile installer for Play Store.
240. How to design a secure enclave communication between TEE (Trusted Execution Environment) and Android app?
Use KeyStore with StrongBox, or proprietary TEE APIs. For high-security biometric data.
241. How to implement a custom filesystem in Android using FUSE?
Requires native daemon, fuse library, root or system app. Extremely rare; for enterprise containerization.
242. How to perform automated performance regression testing with Jetpack Benchmark and CI?
Integrate benchmarks in CI, compare results against baseline, fail build if regressed. Business: maintain app fluidity.
243. How to implement an AI-based code review bot that analyzes Android architecture violations?
Use custom lint rules, ArchUnit, static analysis with Kotlin compiler APIs. Automate PR reviews.
244. How to use the Android `Vulkan` API to render a custom 3D engine for product configurator?
Write Vulkan renderer, load 3D models, apply materials. Superior performance for complex scenes.
245. How to implement a custom boot receiver that starts a service before user unlock?
Use direct boot aware components, encrypt sensitive data until user unlock. For alarm apps.
246. How to manage an Android project with 100+ modules and shared version catalogs?
Use Gradle version catalogs (libs.versions.toml), convention plugins. Consistent dependencies, easier upgrades.
247. How to contribute to the Android Open Source Project (AOSP) by fixing a framework bug?
Set up AOSP build, find bug, submit patch to Gerrit. Deep understanding of internals.
248. How to build a custom Android ROM with enhanced privacy features?
Modify AOSP, add permission controls, de-google services. For privacy-focused niche.
249. How to implement a real-time translation app using on-device ML Kit translation?
Download language models, use ML Kit Translate, process text/speech. Offline capable.
250. How to use the Android Car API to build a media app for Android Automotive OS?
Implement MediaBrowserService, design UI with car app library constraints. Business: radio app for cars.
251. How to detect and prevent tapjacking and overlay attacks?
Set filterTouchesWhenObscured, use FLAG_WINDOW_IS_OBSCURED. Security measure for financial apps.
252. How to implement a custom Input Method Editor (IME) like a gesture keyboard?
Extend InputMethodService, handle touch, generate text. Very complex.
253. How to integrate a JavaScript engine (like V8) in Android app for dynamic scripting?
Use J2V8 or QuickJS. Allows running user scripts safely in sandbox. For customizable business rules.
254. How to perform bytecode manipulation with ASM or Javassist for runtime code injection?
Transform classes during build, add logging, analytics. For AOP. Use ByteBuddy for simplicity.
255. How to use the Android `DataStore` with multi-process access?
DataStore is not multi-process safe; use ContentProvider or file locking if needed. Design accordingly.
256. How to implement a server-driven UI framework in Android similar to Litho or Epoxy?
Define UI schema JSON, parse and create widgets dynamically. Allows updating UI without app release. Business: e-commerce homepage.
257. How to handle a crash caused by a native library in production?
Use Google Play's native crash reports, ndk-stack to symbolize, identify null pointer or buffer overflow. Fix in native code.
258. How to design a scalable push notification system that handles millions of users with FCM topics?
Use topics for broadcast, device groups for personal messages. Throttle, handle token refresh. Efficiently reach users.
259. How to build a custom Android launcher (home screen replacement)?
Register as home activity, implement app drawer, widgets. Complex but possible.
260. How to implement an offline-first app with GraphQL and Apollo Android including cache normalization?
Apollo client with normalized cache, optimistic updates, sync mutations when online. Great for collaborative tools.

No comments:
Post a Comment
Thanks for your valuable comment...........
Md. Mominul Islam