What if you could add shiny new UI parts without breaking your whole app?
Why Compose with existing Views (interop) in Android Kotlin? - Purpose & Use Cases
Imagine you have an Android app with many screens built using old Views like Buttons, TextViews, and RecyclerViews. Now you want to add new, modern UI parts using Jetpack Compose without rewriting everything.
Rebuilding the whole app from scratch is slow and risky. Mixing old Views and new Compose UI manually means writing complex code to manage both, which is error-prone and hard to maintain.
Compose with existing Views interop lets you smoothly combine Compose UI and traditional Views in the same screen. You can reuse old Views inside Compose or add Compose UI inside View layouts easily.
val oldButton = findViewById<Button>(R.id.old_button)
oldButton.setOnClickListener { /* handle click */ }AndroidView(factory = { context -> Button(context).apply { setOnClickListener { /* handle click */ } } })You can modernize your app step-by-step, mixing new Compose UI with existing Views without rewriting everything.
A shopping app wants to add a fancy Compose-based product card but keep the old cart screen built with Views. Interop lets both UI styles work together seamlessly.
Old Views and new Compose UI can live together smoothly.
No need to rewrite entire app to use Compose.
Interop saves time and reduces bugs when mixing UI types.