Android
433 bites tagged Android — interview questions with model answers, and 60-second explainers.
Create a custom View from scratch that draws a shape
This tests Android View measurement and drawing contracts. A strong answer covers: onMeasure resolves dimensions against parent MeasureSpec; onDraw renders with Canvas and Paint; constructors parse attributes.
Roles of minifyEnabled and shrinkResources and common pitfalls
Tests R8 code shrinking vs resource stripping and runtime risks. Outline: minifyEnabled shrinks code; shrinkResources removes unused assets and requires minifyEnabled; dynamic access like getIdentifier() crashes; keep resources with tools:keep or keep.xml.
Chain WorkManager tasks and pass a file URI between workers.
This tests WorkManager chaining and data passing. A strong answer chains Download, Unzip, and Process with WorkContinuation, passes URI via outputData, and reads it with inputData. A red flag is suggesting global state, SharedPreferences, or thread blocking.
OneTimeWorkRequest vs PeriodicWorkRequest and minimum repeat interval
Tests WorkManager scheduling constraints and battery tradeoffs. Contrast one-shot chaining with non-chained periodic work, cite the 15-minute minimum, and tie it to system batching under Doze and App Standby. Red flag: claiming exact intervals or no minimum.
Difference between @Path and @Query in Retrofit with example URLs
Tests Retrofit URL construction. @Path fills a path template like /users/{user}/repos with "octocat" to make /users/octocat/repos. @Query appends ?q=retrofit to /search/repos. Red flag: claiming @Query changes the path.
How do you diagnose and optimize a slow Room query?
Tests SQLite profiling and Room optimization. Isolate the query with Database Inspector, run EXPLAIN QUERY PLAN to spot scans, then add covering indexes, rewrite joins, or use Paging3. Red flag: blindly adding indexes or switching to NoSQL without measuring.
Explain touch event dispatch in a ViewGroup with a clickable child
It tests touch routing through the three key methods. A strong answer traces ACTION_DOWN from root to target, notes intercepting halts child delivery, and onTouchEvent true consumes while false bubbles up.
How do include, merge, and ViewStub optimize deep layout nesting?
This tests Android view inflation and hierarchy flattening. A strong answer covers include for reuse, merge to strip redundant parents during inflation, and ViewStub for lazy-loading heavy views. A red flag is conflating them or citing XML brevity alone.
What are RecyclerView.Adapter and ViewHolder, and why do they improve scrolling?
This tests RecyclerView's data-to-view separation. A strong answer says Adapter binds data while ViewHolder caches findViewById results, avoiding hierarchy scans on scroll. A red flag is calling ViewHolder a memory saver instead of a lookup cache.
How does App Bundle handle ABI splits versus multi-APK?
Tests dynamic delivery of native libs: AAB auto-generates per-ABI config splits, but multi-APK requires manual APK builds per ABI. Misconfiguration ships unused .so bloat or crashes on unsupported devices. Red flag: calling AAB a simple multi-APK zip.
Write the ProGuard keep rule to fix reflection after R8
This tests R8 dead-code removal and exact ProGuard syntax for reflective constructors. A strong answer gives -keep class com.example.T { <init>(...); } because R8 cannot trace dynamic class names. Broad -keep rules or omitting constructor are red flags.
Describe Hilt's component hierarchy and scope injection rules
Tests whether you understand Hilt's generated component tree and scoping rules. A strong answer lists the hierarchy, explains parent-outlives-child semantics, and states that ActivityScoped-into-Singleton injection fails at compile time.
Functional difference between @Binds and @Provides in Hilt
Tests if you understand Hilt code generation tradeoffs. @Binds wires an existing injectable implementation to an interface with less overhead; @Provides constructs instances manually.
Explain Retrofit Interceptors and write a static API key interceptor
Tests OkHttp interception and application versus network scope. Strong answers build a new request adding X-Api-Key via newBuilder and chain.proceed; contrast addInterceptor once versus addNetworkInterceptor per hop.
How would you use Retrofit to GET /posts/{id} and key components?
This checks your understanding of Retrofit's three-layer setup. You need a data class for JSON parsing, an interface with @GET and @Path, and a Retrofit.Builder with baseUrl and a converter.
How does a ViewModel survive configuration changes and what is its scope?
The framework retains ViewModels in a store scoped to an Activity or Fragment across config changes, clearing them only when the owner finishes for good. knowledge of ViewModelStore and lifecycle scope.
What is the difference between a started service and a bound service?
Started services run until stopped via startService with no caller interface; bound services expose an IBinder and destroy when all clients unbind. Android service lifecycle and IPC boundaries.
Explain the difference between Gradle build types and product flavors.
If you know build types are how an app is built—debug versus release—while flavors are what is shipped, like free versus paid. Variants are the Cartesian product. Treating them as interchangeable or using flavors for debug and release.
Explain the difference between Kotlin's let, run, with, apply, and also
Group by this (apply, run, with) vs it (let, also), then by return type. Whether you know the two axes of Kotlin scope functions: receiver (this vs it) and return value (context vs lambda result). Using them randomly.
What do the safe call and Elvis operators do in Kotlin?
?. yields null if receiver is null; ?: provides the right operand when left is null; chain as val len = str?.length ?: 0. Kotlin null-safety and default-value fallback. Using !!, verbose if checks, or stating ?.
Upload Key vs App Signing Key
Your upload key is a disposable badge for Google Play, not the signature users install. You sign release AABs with it before uploading. Treating it as unlosable or committing it to git are common mistakes.
React Native Android Release Builds
A release build is the shipping crate: optimized JS, shrunk native code, and a cryptographic signature the Play Store trusts. Generate it before any Play Store upload. Lose your signing keystore and you can never update the app again; back it up immediately.
Native Module Threading Model
Native modules run on their own threads, not the JS thread or main UI thread. Heavy work stays off the JS event loop, but UI mutations must be manually dispatched to the main thread. Assuming they are main-thread safe causes crashes and ANRs.
Building Android Native Modules in React Native
Native modules let JavaScript invoke Android APIs in Kotlin or Java. You build them when no library covers a device capability or you must reuse native code. The classic mistake is blocking the UI thread inside a @ReactMethod or mismatching getName() in JS.
Get Android bites daily.
Five a day, five minutes, offline. With quizzes so it sticks.
Open testing — you’ll join as an early tester.