Managing UI State Across Configuration Changes with Android ViewModel
Learn how to use Android ViewModel to persist UI state across screen rotations and configuration changes while avoiding memory leaks and handling process death.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Learn how to use Android ViewModel to persist UI state across screen rotations and configuration changes while avoiding memory leaks and handling process death.
Ktor's ContentNegotiation plugin removes hand-rolled JSON serialization from your route handlers. Here's how to set it up with kotlinx.serialization, and the traps worth avoiding.
Implement a lightweight, secure JWT auth layer in Ktor using the built‑in Authentication plugin and a small relational revocation table. The design balances statelessness, scalability, and revocation control, with clear trust boundaries, operational hooks, and failure‑mode guidance.
Learn how to lift state in Jetpack Compose, turning stateful components into reusable stateless ones. Understand the benefits, trade‑offs, and a concrete example with a search bar.
Learn how to bridge Flutter and native code using MethodChannel, EventChannel, and BasicMessageChannel. Includes a full battery-level example and critical threading guidelines.
Kotlin sealed classes and interfaces model finite domain states with compiler-checked exhaustive when expressions. Covers syntax, serialization, sealed interfaces for multiple inheritance, and production trade-offs: binary compatibility, DEX count, R8 stripping.
Learn how to spot, diagnose, and resolve UI freezes caused by Kotlin's runBlocking on Android's main thread, with step‑by‑step checks, code fixes, and verification tips.
Hardcoded string paths in Ktor routes hide renaming bugs until runtime. The Resources plugin turns endpoints into typed classes so the compiler catches mismatches — here's how to set it up and where it falls short.
Activities get destroyed on rotation and take your UI state with them. Here's how ViewModel + LiveData fixes that, with a working counter example and three ways to verify the lifecycle behavior yourself.