What Is Jetpack Compose?
Understand declarative UI in Android.
What Is Jetpack Compose? is a free Android Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Android Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
What Is Jetpack Compose?
Jetpack Compose is Android's modern toolkit for building native UI. Instead of writing XML layout files, you describe your UI directly in Kotlin code.
Compose is declarative: you tell it what the screen should look like for a given state, and it figures out how to draw and update it.
The Old Way: XML Views
Traditionally, an Android screen needed two parts:
- An XML layout file describing the widgets.
- Kotlin/Java code that finds those views with
findViewByIdand mutates them.
Keeping the XML and the code in sync was tedious and error-prone.
<!-- res/layout/activity_main.xml -->
<TextView
android:id="@+id/greeting"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />Imperative vs Declarative
With XML views you write imperative code: grab a view, then change it step by step.
With Compose you write declarative code: describe the final result as a function of your data. When data changes, Compose redraws what is needed automatically.
// Imperative (old views)
val tv = findViewById<TextView>(R.id.greeting)
tv.text = "Hello"
tv.visibility = View.VISIBLEComposable Functions
The building block of Compose is the composable function: a normal Kotlin function annotated with @Composable that emits UI.
Composables can call other composables, letting you build screens from small reusable pieces.
@Composable
fun Greeting(name: String) {
Text(text = "Hello, $name!")
}No findViewById
In Compose there is no findViewById and no view IDs. The UI is the function call. To show different text you simply pass a different argument and let Compose recompose.
@Composable
fun Screen() {
Greeting(name = "Ada")
Greeting(name = "Linus")
}UI as a Function of State
A core idea: UI = f(state). The screen is the output of your composables given the current state. Change the state, and the same function produces a new UI.
This makes UIs predictable and easier to reason about.
Everything Is Kotlin
Because composables are Kotlin functions, you can use loops, conditionals, and variables to build UI. No special template language is required.
@Composable
fun Items(names: List<String>) {
for (n in names) {
Text(text = n)
}
}Less Boilerplate
Compose removes huge amounts of glue code. There is no XML inflation, no adapters for simple lists, and no manual wiring between layout and logic.
The result: fewer files and fewer bugs.
Interoperable with Views
You do not have to rewrite an entire app. Compose interoperates with the old View system. You can embed Compose inside an existing XML screen, or embed a View inside Compose.
This lets teams migrate gradually.
What You Need
To use Compose you need:
- A recent Android Studio.
- The Compose dependencies in your Gradle file.
- An activity that calls
setContent { }to host composables.
A Tiny Screen
Here is a complete minimal Compose screen. setContent is the bridge from the Android Activity into the Compose world.
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
Greeting(name = "World")
}
}
}Quick Check
What best describes Jetpack Compose?
Recap
You learned that Jetpack Compose is a declarative, Kotlin-first UI toolkit. Key ideas:
- UI is built from
@Composablefunctions. - No XML and no
findViewById. - UI = f(state) — change state, Compose redraws.
Frequently asked questions
Is the “What Is Jetpack Compose?” lesson free?
Yes — the full text of “What Is Jetpack Compose?” is free to read here on the web, and the Android Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Android Academy course, upgrade to CoddyKit PRO.
What will I learn in “What Is Jetpack Compose?”?
Understand declarative UI in Android. You practise Android Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Android Academy?
No prior experience is required. Android Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “What Is Jetpack Compose?” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Android Academy lesson?
Yes. Every Android Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- What Is Jetpack Compose?
- Your First Composable
- Text, Image, and Button
- Previews and Hot Reload