Skip to content
tezvyn:

Android & Kotlin

Jetpack Compose, Android Studio, Kotlin, Material You

113 bites

Test yourself: Top 30 advanced Android & Kotlin interview questionsMultiple choice, with the correct answer and why it is correct on every question. Free, no sign-in.

Advanced everything in Android & Kotlin, page 5

Testing Coroutines: Control Time with `runTest`
advanced2 min read

Testing Coroutines: Control Time with `runTest`

Test asynchronous coroutine code as if it were synchronous. The kotlinx-coroutines-test library lets you control a virtual clock. Use runTest to wrap tests calling suspend functions, ensuring your test waits for async work before asserting results.

advanced2 min read

Handler and Looper: Android's Threading Backbone

A Looper is a worker that endlessly processes a queue of tasks for a thread. A Handler is how you give that worker a new task from another thread, like updating the UI. The footgun is blocking the main thread's Looper, which freezes your app.

advanced2 min read

JobScheduler: Efficient, Deferrable Background Tasks

Think of JobScheduler as Android's smart alarm for tasks. You specify conditions like 'Wi-Fi only' or 'charging,' and the OS runs your job efficiently to save battery. Use it for deferrable work like data syncs. Footgun: It's not for exact timing.

Expedited Work: High-Priority Background Tasks in Android
advanced2 min read

Expedited Work: High-Priority Background Tasks in Android

Expedited work is for important, short tasks that must run quickly. It gets higher priority than regular background work without requiring a persistent notification. Use it for sending messages or saving notes.

Testing with Hilt: Swapping Dependencies for Isolation
advanced2 min read

Testing with Hilt: Swapping Dependencies for Isolation

Hilt testing swaps real app components for fakes, isolating your code under test without manual setup. It's used in UI and unit tests to replace production dependencies like network clients with test doubles.

advanced2 min read

OkHttp Caching: Beyond Simple Hits and Misses

OkHttp's cache acts like a browser's, saving network trips by storing responses on disk. It handles not just full hits and misses, but also validates stale data with the server. Use it for repeatable requests.

advanced2 min read

Certificate Pinning: Trusting Only Your Own Servers

Certificate pinning hardcodes your server's public key hash into your app, rejecting any other certificate. This prevents man-in-the-middle attacks from compromised CAs. The footgun: if the server certificate changes, your app breaks until you update the pin.

advanced2 min read

FileProvider: Securely Share Files Between Apps

FileProvider is Android's bouncer for files, replacing insecure file:/// URIs with temporary, permission-granted content:// URIs. Use it to send a photo for editing or attach a PDF to an email.

Testing Room Databases: On-Device vs. Local JVM
advanced2 min read

Testing Room Databases: On-Device vs. Local JVM

Test your Room database in two ways: on an Android device for realism, or on your local JVM for speed. This is crucial for verifying DAO queries and preventing data bugs. The footgun is assuming local tests behave identically to on-device tests.

Room: Querying Relational Data Without Manual Joins
advanced2 min read

Room: Querying Relational Data Without Manual Joins

Room lets you query related objects without writing raw SQL joins, mapping one-to-many or many-to-many relationships into nested objects. This is key for fetching a user and their posts in one go.

Navigation Safe Args: Type-Safe Navigation in Android
advanced2 min read

Navigation Safe Args: Type-Safe Navigation in Android

Navigation Safe Args generates code to prevent runtime crashes when passing data between Android screens. It replaces error-prone Bundle manipulation with type-safe classes. Use it to pass user IDs or item details. The footgun: don't pass large objects.

Deep Linking with Android's Navigation Component
advanced2 min read

Deep Linking with Android's Navigation Component

Deep linking with the Navigation Component treats app screens like URL-addressable pages. It's for handling push notifications or web links that go to specific content.

Android's Domain Layer: Your Business Logic's Home
advanced2 min read

Android's Domain Layer: Your Business Logic's Home

The Domain Layer is an optional buffer between your UI and data layers, housing reusable business logic. Use it for complex logic or simple rules shared by multiple screens, keeping your ViewModels lean. The footgun is overusing it for every simple data fetch.

Compose UI Testing: Find Nodes, Assert State, Perform Actions
advanced2 min read

Compose UI Testing: Find Nodes, Assert State, Perform Actions

Compose UI tests treat your UI as a node tree. You find nodes by properties (like text or a test tag), assert their state (e.g., 'is displayed'), and perform actions like clicks. Use it to verify composables react correctly to state changes or user input.

CompositionLocal: Implicitly Pass Data Down the UI Tree
advanced2 min read

CompositionLocal: Implicitly Pass Data Down the UI Tree

CompositionLocal is like CSS inheritance for your UI tree, letting you pass data down implicitly without parameter drilling. It's ideal for ambient data like theming or localization. The footgun is overusing it, which makes components harder to test.

Compose Side-Effects: Escaping the Pure Function
advanced2 min read

Compose Side-Effects: Escaping the Pure Function

Compose functions should be pure, but apps must interact with the world. Side-effect APIs are controlled escape hatches to run non-UI code, like network calls or showing Toasts, from within a composable's lifecycle. The footgun is calling this logic directly.

Android View Animation: A Blueprint for Motion
advanced2 min read

Android View Animation: A Blueprint for Motion

Think of Android's view-based animations as a pre-written score. You define the animation (the "score") in an XML file, then apply it to a View (the "instrument") in your code. This is used for animating properties like alpha or translation on UI elements.

advanced2 min read

MotionLayout: Animate Layouts with States, Not Code

MotionLayout animates layouts by describing start and end states in XML, letting the system handle the transition. Use it for complex UI choreography, like a collapsing toolbar, or to link animation progress to a user's swipe.

Data Binding: Link Android UI to Data in XML
advanced2 min read

Data Binding: Link Android UI to Data in XML

Data Binding lets you connect UI components to data sources directly in XML, eliminating manual findViewById calls. It's used to set view properties based on your ViewModel's state.

WorkManager: Guaranteed, Deferrable Background Work
advanced2 min read

WorkManager: Guaranteed, Deferrable Background Work

WorkManager is Android's smart to-do list for background tasks. It guarantees execution for deferrable work, like syncing data, even if the app closes or the device reboots. The footgun is using it for immediate tasks; it prioritizes system health over speed.

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles