Traditionally, Android apps relied on XML-based layouts. Android development has now shifted to Compose as the standard framework. Compose describes a much larger set of frameworks and application architecture in Kotlin, which isn’t specific only to Android development. For example, the development teams at Slack have developed the Circuit framework, which is built on top of Compose. Compose UI is just one of the seven Compose frameworks specific to the UI layer of app development. Using Compose UI brings many improvements over the old View implementation, including significantly reduced build times, APK size, and runtime performance. It also makes building the UI easier, more intuitive, and easier to maintain and debug. For a more in-depth comparison of Compose versus the old Android View implementation, see the article “Compare Compose and View metrics”.

Modern Android development has shifted from MVVM to MVI (Model-View-Intent) architecture, with Compose UI now used for the UI layer rather than XML layouts. One of the key concepts behind MVI is unidirectional data flow. Quite often, you can have multiple data sources, including local storage and network sources. These are typically abstracted and accessed using a repository pattern. A ViewModel accesses methods on the repository and provides unidirectional data to the UI using Flow. A Flow typically consists of a data emitter and subscribers to the emitter. It provides an efficient memory usage model as the Flow won’t consume memory until and unless an active subscriber is utilizing the data from the Flow. Android has specific implementations of Flow that are Android lifecycle aware. Hence, when a view is no longer visible to the user, data is no longer consumed, and memory is freed up.

In this module, you’ll create a simple app that will introduce you to Jetpack Compose. You’ll use composables to create a user interface with a touch of interactivity. By the end of this module, you’ll have created the UI for this Kodeco Chat, a P2P chat app:

In this first lesson, you’ll create the simplest form of the chat interface comprising a button, a text entry field, and a label. You’ll begin by creating an app from scratch using a template in Android Studio, then progressively refactoring to create the desired interface. Along the way, you’ll see what composables are used for and learn how to name them. You’ll learn:

  • How to create a Compose app.
  • What an Activity is.
  • What the onCreate() lifecycle method does.

It’s time to get started!

See forum comments
Download course materials from Github
Next: Your First Compose App