0:001:03:47

Building Android Applications with Jetpack Compose

Peculiar C. Umeh 1:03:47 2023

Compose swaps the RecyclerView adapter routine for a single composable function

Displaying a list on Android used to mean an XML layout, a RecyclerView and a separate adapter class to create and bind every view. Android developer Peculiar C. Umeh builds a working course-list app live in Android Studio, hitting real Gradle and state errors along the way. For anyone still writing XML layouts, the question is how much of that ceremony a single Kotlin file can actually replace.

Watch a Compose list app built live, from composables and modifiers to state and LazyColumn

Watch on YouTube

In short

Android developer Peculiar C. Umeh live-codes a simple course-list app to show how Jetpack Compose builds native Android UI in Kotlin with less code. She covers composable functions, previews, modifiers, layouts, state and LazyColumn, and argues that Compose is easier and faster than the XML and RecyclerView approach.

“With Jetpack Compose, you can build beautiful, responsive, flexible user interface using a declarative programming model.”
“The lazy column or lazy row layout creates and binds the view as needed.”

What you will learn

  • Set up an Android Studio project from the empty Compose activity template with Kotlin 1.5 or later.
  • Write composable functions and check them instantly with the preview annotation.
  • Use modifiers and the Column and Row layouts to style and arrange UI elements.
  • Manage TextField input with remember and mutable state, and lists with a mutable state list.
  • Replace a RecyclerView and adapter with a LazyColumn of card composables.

Key takeaways from the speaker

  • Android, Kotlin, Jetpack Compose

Details

Level
Beginner
Format
Tech talk
Technical depth
Practitioner
For
Student, Early career, Career changer
Length
1:03:47
Published
June 2023

Questions this talk answers

What do you need to start building an app with Jetpack Compose?

A recent Android Studio (the speaker uses Flamingo) with Kotlin 1.5 or later, and a new project created from the empty Compose activity template, which adds the necessary dependencies and a sample composable.

What is a composable function?

It is a Kotlin function annotated as composable that produces a UI element, and it is the basic building block of a Compose UI.

How do modifiers work in Jetpack Compose?

Modifiers are functions called on a composable element with the dot operator to change its appearance or behavior, such as padding, size or filling the screen.

How does a TextField keep track of what the user types?

A TextField takes a value and an onValueChange lambda; the value is held in state created with remember and mutable state, and the lambda updates it with each new input.

How does LazyColumn compare with RecyclerView for lists?

RecyclerView needs an XML layout and a separate adapter class, while LazyColumn is defined in one composable and creates and binds views as needed. The speaker considers Compose easier, faster and more efficient, though performance depends on UI complexity and the number of items.

About this talk

Jetpack Compose is a modern toolkit for building native Android UI. It simplifies and accelerates UI development on Android with less code, powerful tools, and intuitive Kotlin APIs

Topics

Related talks

Browse the library