Welcome to this course where we will take our first steps with Android Studio using Jetpack Compose. This is the modern and recommended way to develop Android applications.
If you come from Flutter, you're in luck: the concepts are very similar and you will understand the logic quickly. In fact, if you are passionate about mobile development, I recommend that at some point you also explore the Flutter ecosystem, as it will provide a very valuable global perspective for your career.
Additional Resources
- Android Blog: https://www.desarrollolibre.net/blog/android
- Kotlin Course on YouTube: Watch Playlist
- Android Compose Course on YouTube: Watch Playlist
- Book Repository: https://github.com/libredesarrollo/android-studio-blog
What You Will Learn with this book
The book is divided into two parts:
Part 1: Essential Fundamentals
- Chapter 1: Introduction to Kotlin
- We lay the foundations of the modern language for Android. We cover variables, functions, classes, data classes, and the crucial null safety.
In this section, we are going to learn the basics of Kotlin. Our main goal is to master this language so we can later develop modern applications in Android.
Kotlin is a modern programming language that embraces advanced features, such as Null Safety. During the course, we will cover the fundamental pillars:
- Use of variables and constants.
- Conditional structures.
- Functions.
- Object-Oriented Programming (Classes), which will be the bulk of our learning.
You can consume the course in the order you prefer, although it is logical to follow a sequence: for example, understanding variables before moving on to class properties.
Part 2: Modern Android with Compose
- Chapter 2: Fundamental Composables and Layouts
- We configure Android Studio and create our first project. We understand the structure of an app with Compose and the declarative UI paradigm.
- We explore the UI building blocks:
Text,Button,TextField. We learn to organize the screen withColumn,Row, andBox.
- Chapter 3: Advanced Features in Android with Jetpack Compose
- We display web content with
WebViewand communicate with the user through Notifications, including permission and channel management. - API Consumption with Retrofit: We fetch data from the internet using Retrofit. We model JSON responses, handle loading and error states, and display the data in the UI.
- Web Integration and Notifications: We display web content with
WebViewand communicate with the user through Notifications, including permission and channel management.
- We display web content with
- Chapter 4: Integration of External Services in Jetpack Compose
- Audio and Video Playback: We integrate multimedia capabilities, playing audio with
MediaPlayerand embedding YouTube videos, correctly managing the lifecycle. - Access to Device Sensors: We take advantage of the device hardware, focusing on the accelerometer to detect the phone's movement and orientation.
- Custom Drawing with Canvas: We unleash creativity by learning to draw directly on the screen with the
CanvasComposable to create custom graphics and components. - Bringing the Interface to Life with Animations: We explore Compose's powerful animation API to animate visibility, color, size, and position, creating a fluid user experience.
- Audio and Video Playback: We integrate multimedia capabilities, playing audio with
- Chapter 5: Practical Project - Creating a To-Do List App
- It's time to bring it all together! In this chapter, we will build a complete to-do list application from scratch, applying concepts of state, navigation, ViewModel, and animations.
What are we going to learn?
In this book, we will focus on how to work with Android taking advantage of the fact that we already know Kotlin. Being a very visual technology, we will learn to create components from the most basic to the most complex:
- Base components: Creating buttons and texts.
- Organization: Using columns and rows to structure the interface (what we knew in classic Android as ListViews or RecyclerViews).
- Advanced components: Implementation of Cards, visual alerts (Snackbars), progress bars, and Bottom Sheets.
🧩 From Widgets to Composables
If you come from Flutter, you will be used to Widgets; here in Android, we work with Composables. In practice, they are almost the same: a reusable piece of code.
A Composable is nothing more than a Kotlin function with the @Composable decorator. This tells the system that this function defines a part of the interface. Unlike a simple button, components like the Bottom Sheet have their own lifecycle and can contain multiple elements, allowing us to delve deeper into both the Kotlin language and the Android ecosystem.
🚀 Why Jetpack Compose? (Goodbye to XML)
If you knew old Android development, you will remember XML views. Personally, I abandoned Android years ago because working with XML was tedious and forced.
The great news is that with Jetpack Compose, views are 100% code. We no longer need XML files to define the interface (except in very specific cases of legacy code or extremely specific behaviors). This modernization is what has made many developers enjoy Android again.
Who this book is for
This book is for all those developers who want to learn how to create native applications for Android using the modern tools recommended by Google. It is assumed that the reader has prior knowledge of programming, though not necessarily in mobile development.
We will start from the bases of the Kotlin language and gradually build complete and functional applications with Jetpack Compose.
The journey of Android development is continuous, but with what you have learned in this book, you already have the most important tools in your belt; it is a basic book to take the first steps with Modern Android and will have more content in the future.