Skip to content
tezvyn:

All bites

The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.

8668 bites

Page 88

Architect periodic and on-demand sync with WorkManager
Android & Kotlin2 min read

Architect periodic and on-demand sync with WorkManager

Tests combining periodic and push WorkManager requests safely. Outline: one Worker class, PeriodicWorkRequest hourly and OneTimeWorkRequest on push, with ExistingWorkPolicy.KEEP plus constraints. Red flag: two Workers, no deduplication, or ForegroundService.

How would you implement a constrained photo upload with WorkManager?
Android & Kotlin2 min read

How would you implement a constrained photo upload with WorkManager?

Tests knowledge of WorkManager constraints and retry policies for deferrable background uploads. A strong answer names OneTimeWorkRequest with Constraints for charging and unmetered network, plus BackoffPolicy for retry.

Android & Kotlin2 min read

How do you implement OAuth2 token refresh with Retrofit Authenticator?

Implement authenticate() with a blocking refresh, new Request with new token, Mutex for parallel 401s.

Create a custom View from scratch that draws a shape
Android & Kotlin2 min read

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
Android & Kotlin2 min read

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.
Android & Kotlin2 min read

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
Android & Kotlin2 min read

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.

Android & Kotlin2 min read

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?
Android & Kotlin2 min read

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
Android & Kotlin2 min read

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?
Android & Kotlin2 min read

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?
Android & Kotlin2 min read

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?
Android & Kotlin2 min read

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
Android & Kotlin2 min read

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
Android & Kotlin2 min read

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
Android & Kotlin2 min read

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.

Android & Kotlin2 min read

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.

Android & Kotlin2 min read

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?
Android & Kotlin2 min read

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.

What is the difference between a started service and a bound service?
Android & Kotlin2 min read

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.