Lynxbee topic

Kotlin

Articles about Kotlin.

Fix RecyclerView Orientation WrongConstant

`WrongConstant` is Android lint telling you that an integer came from outside the API’s documented constant set. Use the constant family declared by the parameter, then investigate dependency or lint-version drift if an official alias is still flagged.

Fix ContextImpl Cannot Be Cast to Activity

`Context` is a capability family, not another name for `Activity`. Find the failing cast, decide whether the operation truly needs a UI owner, and change the API contract instead of swapping context methods until the crash disappears.

Prevent Screenshots in Android with FLAG_SECURE

`FLAG_SECURE` asks Android to keep a window out of screenshots and non-secure displays. Apply it before sensitive UI appears, understand its window-wide scope, and treat newer detection and screen-share APIs as complementary—not interchangeable—controls.

Read Android API Level and Build Information Safely

Android’s `Build` and `Build.VERSION` APIs expose platform and firmware metadata, but those values serve different purposes. Use the numeric API level for compatibility checks, treat display strings as diagnostics, and avoid turning hardware fields into tracking identifiers.

Keep Android Immersive Mode After a PopupMenu

A PopupMenu temporarily owns window focus, so Android may reveal system bars. Use the current WindowInsets controller, track whether fullscreen remains desired, and restore bars only after focus returns or the popup is dismissed—without fighting system gestures or accessibility.

Monitor Android Network Connectivity Correctly

A connected Wi-Fi or cellular network is not proof that your server is reachable. Observe Android’s default network and capabilities, expose conservative UI state, and let each request handle DNS, TLS, timeout, authentication, and server failures independently.

Build Picture-in-Picture Video on Android

Picture-in-picture lets eligible video continue in a system-managed floating window while the user navigates elsewhere. Implement it as a player-state transition, with modern auto-entry, lifecycle-aware UI, graceful fallbacks, and device-level tests.

Build Your First Android App with Kotlin and Compose

Create a small but real Android app in modern Android Studio using Kotlin and Jetpack Compose. You will choose a package and minimum SDK, understand the generated project, build stateful UI, preview and test it, deploy to an emulator or phone, inspect logs, produce a debug APK, and know what changes for release.

Android Geocoder “grpc failed”: Causes and Safe Fixes

The Android Geocoder message “java.io.IOException: grpc failed” is a service failure, not proof that coordinates or permissions are wrong. Use the modern asynchronous API, keep legacy calls off the main thread, separate empty results from errors, and design a graceful fallback.

Engineering weekly

Useful technical knowledge, not inbox noise.

Receive verified fixes, references, labs, and tools. Confirm by email; unsubscribe any time.