Pattem Digital - Software Product Engineering Company
Kotlin for Android Development

Kotlin for Android, How We Build Modern UIs with Jetpack Compose

Notes from our Android team on Jetpack Compose and Kotlin for Android. State, migration from XML views, testing, and the speed habits that keep screens fast.

Know What We Do

Why do Android teams pair Kotlin with Jetpack Compose?

Graphic explaining how Jetpack Compose builds Android UI in Kotlin as a function of state, shipped as Jetpack libraries

Jetpack Compose is Android's modern toolkit for building native UI in Kotlin. You describe what a screen should look like for a given state. When that state changes, Compose updates the screen. There's no XML layout file and no view binding step to keep in sync with the code.

That's why Compose and Kotlin for Android now go together. Compose is written in Kotlin and relies on a Kotlin compiler plugin, so you can't write composable functions in Java. If your app is still mostly Java, your Compose plan starts with a Kotlin plan.

Why Compose ships as libraries

Compose isn't built into the Android OS. It ships as Jetpack libraries inside your app. Teams get fixes and new components by bumping a dependency, not by waiting for users to update Android. Screens also behave the same across the older Android versions your app still supports.

That choice shapes how we adopt it. You can add Compose to one module and try it on a single screen. If something goes wrong, you roll back by reverting a build change.

What changes when the UI becomes a function of state

With Views, you build a tree of widgets and then change it as data arrives. You set text, toggle visibility, and hope nothing else touched that view. In Compose, a composable function takes data and emits UI. When the data changes, Compose runs the function again for the parts that depend on it. That's called recomposition.

You'll feel the effects in the first sprint. Not all of them are good news for a team that expects the toolkit to fix every UI problem.

  • Screens shrink, because adapters, view holders, and layout files go away.
  • Bugs move from stale views to state that lives in the wrong place.
  • Previews in Android Studio let developers check several states without running the app.

The middle point is the one teams miss. Compose doesn't remove UI bugs. It moves them. The fix is a clear rule about which layer owns each piece of state, agreed before the first screen ships.

What does Jetpack Compose change in Android Kotlin code?

Graphic showing how Jetpack Compose changes Android Kotlin code, from state hoisting to interop with classic Views

Three habits change in Android Kotlin code. UI becomes plain Kotlin functions. State gets a clear owner. Lists, themes, and navigation move out of XML resources and into Kotlin.

State is the habit that matters most. A composable can hold small local state with remember and mutableStateOf. Anything that must survive a configuration change, or that comes from data, belongs in a ViewModel, usually exposed as a StateFlow. The composable collects it and passes plain values down to its children. This is called state hoisting, and it keeps composables easy to preview and test.

Where Compose and Views meet

Interop works both ways, and that's what makes gradual adoption realistic. ComposeView puts Compose content inside an existing Fragment or XML layout. AndroidView does the reverse. It hosts a classic view, such as a map or a web view, inside a composable.

On our projects, interop is where most review time goes. A screen that mixes both systems needs one owner for each piece of state. Otherwise the view and the composable fight over the same value. We write that rule down before the first mixed screen ships.

Navigation is the other seam. While the islands are small, keep the existing navigation graph and let each Fragment host its Compose content. Move a flow to Navigation Compose only when every screen in it is a composable. That way one flow never runs two navigation systems at once.

How do Views and XML compare with Jetpack Compose?

Most teams carry both toolkits for a while. So it helps to know where each one stands on the jobs that eat the most time. These are the differences we explain first when a View based team starts its first Compose screen.

  • Layouts become code, not resources. XML layouts and view binding give way to composable functions built from Row, Column, and Box.
  • Lists get much simpler. A RecyclerView with an adapter and view holder becomes a LazyColumn or LazyRow with an items block.
  • Theming moves into Kotlin. XML styles and theme attributes become a MaterialTheme with color, type, and shape values.
  • Previews cut emulator round trips. The Preview annotation renders composables inside Android Studio for several states at once.
  • Tests target semantics. Espresso view matchers give way to Compose test rules that find nodes by text, content description, or test tag.

Neither toolkit is going away soon. Views are still supported, and plenty of stable screens can stay in XML while new work goes to Compose.

How do you move an existing app to Jetpack Compose?

Graphic of the Compose Island Method for moving an existing Android app to Jetpack Compose one screen at a time

Move one screen at a time, starting where your team changes code most often. A full rewrite freezes feature work for months and rarely pays for itself. Gradual adoption keeps the app shippable every sprint, and the team builds Compose skills on screens that matter.

Teams that do Kotlin Android development well treat this as a product decision, not just a technical one. They agree which screens move, in what order, and what done means for each one. Only then does anyone delete an XML file. Skip that talk and the migration tends to drift.

Why the simplest screen is the wrong place to start

The usual advice is to migrate your simplest screen first, such as settings or an about page. It feels safe. It also teaches the team almost nothing. Static screens have little state, rarely change, and never touch the hard parts of Compose.

Pick a screen your product team changes every few sprints instead. The first conversion takes longer. But every later change to that screen is faster, so the effort pays back while the migration is still running. The team also hits real state, loading, and error problems while senior engineers are watching closely.

Performance habits that hold up in production

Measure before you tune. The Layout Inspector in Android Studio shows recomposition counts. That tells you whether a screen is doing extra work or just feels slow on a debug build. Most of the fixes we apply are small and boring.

  • Read fast changing state, such as scroll position, as late as possible, inside a lambda or derivedStateOf.
  • Give every lazy list item a stable key, so reordering doesn't rebuild the whole list.
  • Keep heavy work out of composition, and move sorting or formatting into the ViewModel.
  • Pass immutable data classes as parameters, so Compose can skip composables whose inputs didn't change.
  • Ship baseline profiles and check startup on a release build with R8 turned on.

Testing Compose screens

Compose tests run against the semantics tree. That's the same structure accessibility services use. A test written with createComposeRule finds a node by its text or content description, clicks it, and checks what should appear next. Good semantics make good tests, and they help screen reader users too.

Screenshot tests earn their keep on design system components, where a small visual slip can spread across dozens of screens. For business screens, behavior tests on the semantics tree tend to catch more real defects for the effort.

Mistakes we keep seeing on migrations

These show up on Android projects of every size. Each one is far cheaper to prevent at the start than to unwind once dozens of screens depend on it.

  • Rewriting the whole UI at once and freezing feature delivery.
  • Keeping business logic inside composables because it was quick to write.
  • Running side effects, such as a snackbar, directly in a composable body instead of inside LaunchedEffect.
  • Using collectAsState where collectAsStateWithLifecycle would stop work while the screen is hidden.
  • Converting screens without updating the tests, which leaves Espresso suites that no longer match the UI.
  • Building a second design system in Compose that drifts from the XML theme still in use.

The Compose Island Method, stage by stage

Our teams run migrations with a pattern we call the Compose Island Method. Each converted screen is an island of Compose inside the existing app. The islands grow until the old View code is the minority. Five stages keep the work predictable.

  1. Lay the foundation. Turn on Compose in the build, recreate your theme as a MaterialTheme, and build the few shared components every screen needs, such as buttons, text fields, and app bars.
  2. Pick the first island. Choose a screen with frequent changes and few dependencies. Host it with ComposeView inside the existing Fragment, so navigation stays as it is.
  3. Hoist the state. Move screen state into a ViewModel that exposes a StateFlow. Keep composables stateless wherever the design allows.
  4. Connect the islands. Once several screens are in Compose, move lists to lazy layouts. Consider Navigation Compose for flows that now live fully in Compose.
  5. Retire the old shore. Delete unused XML layouts and adapters, replace Espresso tests with Compose tests, and add baseline profiles for the busiest journeys.

Finishing each stage matters more than the exact order. Half migrated screens, where a Fragment holds some state and a composable holds the rest, are the costliest code to maintain in a Compose codebase.

How Pattem Digital helps teams adopt Jetpack Compose

Pattem Digital works with product teams that want Jetpack Compose without a feature freeze. We usually start with a short review of the codebase, the theme, and the test suite. Then we agree on the first island and what done means at each stage of the method above.

As a Kotlin app development company, we can lead the migration, pair with your engineers screen by screen, or build new features in Compose while your team keeps the current app running. Either way, the goal is a codebase your own developers can keep moving forward.

Hire Kotlin and Jetpack Compose Developers

Bring in Android engineers who write Kotlin every day and build screens in Jetpack Compose. They know how to move an existing View based app to Compose without stopping feature delivery.

Staff Augmentation

Add Kotlin and Compose engineers to your Android team to convert screens, build features, and review state handling.

Build Operate Transfer

We build a Kotlin Android team with Compose practices in place, run it with you, then hand over the team and its playbook.

Offshore Development Center

An offshore development center gives you a steady Kotlin Android team for Compose migration and ongoing feature work.

Product Outsource Development

We own an Android product from design to release, with its UI in Jetpack Compose and its logic in clean, idiomatic Kotlin.

Managed Services

We maintain your Kotlin Android app, handle library updates, fix defects, and keep Compose screens fast on real devices.

Global Capability Centre

A global capability centre can host your core Android team and its Compose design system under your own governance.

Capabilities of Our Kotlin Android Team

  • Jetpack Compose screens and shared design system parts

  • Step by step migration from XML views with ComposeView

  • ViewModel and StateFlow architecture with one way data flow

  • Compose UI tests, baseline profiles, and release profiling

Our Kotlin developers build Compose screens with clear state ownership, tested semantics, and release build speed checks.

Take it to the next level.

Move to Jetpack Compose Without Pausing Releases

Tell us which screens your team changes most. We'll help you pick the first island and plan a migration that keeps your Android releases on time.

Share Blog

Authored By

content roja

Related Blog

Mobile app development

Mobile App Development

Mobile apps help businesses connect with users, provide services easily, and improve daily tasks with better speed and access.

Common Queries

Frequently Asked Questions

Mobile App Development FAQ

Ask us anything about Kotlin, Jetpack Compose, or moving an Android app to Compose.

It's Google's declarative UI toolkit for Android. With Jetpack Compose, developers write Kotlin functions that describe a screen for a given state. When the state changes, Compose updates only the parts that need it, with no XML layouts.

Not directly. Composable functions need the Kotlin compiler plugin, so you write them in Kotlin. The rest of the app can stay in Java while you migrate, and existing Java activities or fragments can host Compose screens through ComposeView.

For new screens, usually yes. Compose needs less code, makes state easier to trace, and gives you live previews in Android Studio. XML views are still supported and stable, so mature screens that rarely change can stay in XML for now.

Yes. Jetpack Compose is open source under the Apache License. It's built in the Android Open Source Project alongside the other AndroidX libraries, so anyone can read the code, file issues, and follow each change as it lands in public.

Most apps call REST or GraphQL APIs through a repository layer, with coroutines and Flow carrying results to the ViewModel. A backend built with Node.js web development suits apps that need light, fast APIs for mobile clients.

Test with real users on real devices, and check accessibility through the same semantics your automated tests use. A structured review, such as our UX audit services, finds friction in flows, forms, and navigation before users do.

Explore

Insights

Read more of our notes on Android engineering, Kotlin, and mobile apps that stay easy to change.