Architecture Components

Learn about app architecture and how to use ViewModels, UI State, and StateFlow to build more complex apps.

 

Welcome to Unit 4

Video Optional

Welcome to Unit 4! This unit covers important topics for you to consider when building apps that have more logic and more screens. The unit includes: app architecture, navigation between different screens in an app, and adaptive layouts.

Stages of the Activity lifecycle

Codelab

In this codelab, you learn about the Activity lifecycle and logging.

Intro to App architecture

Video Optional

Learn how to architect Android apps using design patterns, techniques, and best practices for Android app development.

Architecture: The UI Layer

Video Optional

In this video, you'll learn about the UI layer and how to use unidirectional data flow to handle UI state.

ViewModel and State in Compose

Codelab

In this codelab, you learn how to use a ViewModel, one of the architecture components. You will implement a ViewModel to retain the app state during configuration changes.

Write unit tests to test the ViewModel

Codelab

Learn how to test the ViewModel to verify the correctness, functional behavior, and usability of your app.

Practice: Add a ViewModel to Dessert Clicker

Codelab

Practice adding a ViewModel to an app and abstracting logic away from the Activity.

What's next?

Video Optional

Congratulations on completing Pathway 1 in Unit 4! You have progressed amazingly in your app development journey. In this pathway you built both the Dessert Clicker and Unscramble apps and along the way you learned about the app lifecycle, handling configuration changes, and app architecture.