0Pricing
Android Academy · Lesson

Your First Composable

Create and preview a composable function.

Your First Composable

A composable is just a Kotlin function marked with @Composable. Let's write one that greets a user by name.

@Composable
fun Greeting(name: String) {
    Text(text = "Hello, $name!")
}

The @Composable Annotation

The @Composable annotation tells the compiler this function can emit UI and can call other composables. Without it, you cannot call Text, Button, or other UI functions.

All lessons in this course

  1. What Is Jetpack Compose?
  2. Your First Composable
  3. Text, Image, and Button
  4. Previews and Hot Reload
← Back to Android Academy