How to Build Android Apps with Kotlin (eBook)
704 Seiten
Packt Publishing (Verlag)
978-1-83763-980-9 (ISBN)
Looking to kick-start your app development journey with Android 13, but don't know where to start? How to Build Android Apps with Kotlin is a comprehensive guide that will help jump-start your Android development practice.
This book starts with the fundamentals of app development, enabling you to utilize Android Studio and Kotlin to get started with building Android projects. You'll learn how to create apps and run them on virtual devices through guided exercises. Progressing through the chapters, you'll delve into Android's RecyclerView to make the most of lists, images, and maps, and see how to fetch data from a web service.
You'll also get to grips with testing, learning how to keep your architecture clean, understanding how to persist data, and gaining basic knowledge of the dependency injection pattern. Finally, you'll see how to publish your apps on the Google Play store.
You'll work on realistic projects that are split up into bitesize exercises and activities, allowing you to challenge yourself in an enjoyable and attainable way. You'll build apps to create quizzes, read news articles, check weather reports, store recipes, retrieve movie information, and remind you where you parked your car.
By the end of this book, you'll have the skills and confidence to build your own creative Android applications using Kotlin.
Unleash the power of Android programming to build scalable and reliable apps using industry best practicesPurchase of the print or Kindle book includes a free PDF eBookKey FeaturesBuild apps with Kotlin, Google's preferred programming language for Android developmentUnlock solutions to development challenges with guidance from experienced Android professionalsImprove your apps by adding valuable features that make use of advanced functionalityBook DescriptionLooking to kick-start your app development journey with Android 13, but don't know where to start? How to Build Android Apps with Kotlin is a comprehensive guide that will help jump-start your Android development practice. This book starts with the fundamentals of app development, enabling you to utilize Android Studio and Kotlin to get started with building Android projects. You'll learn how to create apps and run them on virtual devices through guided exercises. Progressing through the chapters, you'll delve into Android's RecyclerView to make the most of lists, images, and maps, and see how to fetch data from a web service. You'll also get to grips with testing, learning how to keep your architecture clean, understanding how to persist data, and gaining basic knowledge of the dependency injection pattern. Finally, you'll see how to publish your apps on the Google Play store. You'll work on realistic projects that are split up into bitesize exercises and activities, allowing you to challenge yourself in an enjoyable and attainable way. You'll build apps to create quizzes, read news articles, check weather reports, store recipes, retrieve movie information, and remind you where you parked your car. By the end of this book, you'll have the skills and confidence to build your own creative Android applications using Kotlin.What you will learnCreate maintainable and scalable apps using KotlinUnderstand the Android app development lifecycleSimplify app development with Google architecture componentsUse standard libraries for dependency injection and data parsingApply the repository pattern to retrieve data from outside sourcesBuild user interfaces using Jetpack ComposeExplore Android asynchronous programming with Coroutines and the Flow APIPublish your app on the Google Play storeWho this book is forIf you want to build Android applications using Kotlin but are unsure of how and where to begin, then this book is for you. To easily grasp the concepts in this book, a basic understanding of Kotlin, or experience in a similar programming language is a must.]]>
Preface
Android has ruled the app market for the past decade, and developers are increasingly looking to start building their own Android apps. How to Build Android Apps with Kotlin starts with the building blocks of Android development, teaching you how to use Android Studio, the integrated development environment (IDE) for Android, with the Kotlin programming language for app development.
Then, you’ll learn how to create apps and run them on virtual devices using guided exercises. You’ll cover the fundamentals of Android development, from structuring an app to building out the UI with activities, fragments, and various navigation patterns. Progressing through the chapters, you’ll delve into Android’s RecyclerView to make the most of displaying lists of data and become comfortable with fetching data from a web service and handling images.
You’ll then learn about mapping, location services, and the permissions model before working with notifications and how to persist data. Next, you’ll build user interfaces using Jetpack Compose. Moving on, you’ll get to grips with testing, covering the full spectrum of the test pyramid. You’ll also learn how Android Architecture Components (AAC) is used to cleanly structure your code and explore various architecture patterns and the benefits of dependency injection.
Coroutines and the Flow API are covered for asynchronous programming. The focus then returns to the UI, demonstrating how to add motion and transitions when users interact with your apps. Toward the end, you’ll build an interesting app to retrieve and display popular movies from a movie database, and then see how to publish your apps on Google Play.
By the end of this book, you’ll have the skills and confidence needed to build fully-fledged Android apps using Kotlin.
Who this book is for
If you want to build your own Android apps using Kotlin but are unsure of how to begin, then this book is for you. A basic understanding of the Kotlin programming language will help you grasp the topics covered in this book more quickly.
What this book covers
Chapter 1, Creating Your First App, shows how to use Android Studio to build your first Android app. Here, you will create an Android Studio project, understand what it’s made up of, and explore the tools necessary for building and deploying an app on a virtual device. You will also learn about the structure of an Android app.
Chapter 2, Building User Screen Flows, dives into the Android ecosystem and the building blocks of an Android application. Concepts such as activities and their lifecycle, intents, and tasks will be introduced, as well as restoring the state and passing data between screens or activities.
Chapter 3, Developing the UI with Fragments, teaches you the fundamentals of using fragments for the user interface of an Android application. You will learn how to use fragments in multiple ways to build application layouts for phones and tablets, including using the Jetpack Navigation component.
Chapter 4, Building App Navigation, goes through the different types of navigation in an application. You will learn about navigation drawers with sliding layouts, bottom navigation, and tabbed navigation.
Chapter 5, Essential Libraries: Retrofit, Moshi, and Glide, gives you an insight into how to build apps that fetch data from a remote data source with the use of the Retrofit library and the Moshi library to convert data into Kotlin objects. You will also learn about the Glide library, which loads remote images into your app.
Chapter 6, Adding and Interacting with RecyclerView, introduces the concept of building lists and displaying them with the help of the RecyclerView widget.
Chapter 7, Android Permissions and Google Maps, presents the concept of permissions and how to request them from the user in order for your app to execute specific tasks, as well as introducing you to the Maps API.
Chapter 8, Services, WorkManager, and Notifications, details the concept of background work in an Android app and how you can have your app execute certain tasks in a way that is invisible to the user, as well as covering how to show a notification of this work.
Chapter 9, Building User Interfaces Using Jetpack Compose, shows how Jetpack Compose works, how to apply styles and themes, and how to use Jetpack Compose in projects started with layout files.
Chapter 10, Unit Tests and Integration Tests with JUnit, Mockito, and Espresso, teaches you about the different types of tests for an Android application, what frameworks are used for each type of test, and the concept of test-driven development.
Chapter 11, Android Architecture Components, provides an insight into components from the Android Jetpack libraries, such as ViewModel, which will help separate the business logic from the user interface code. We will then look at how we can use observable data streams such as LiveData to deliver data to the user interface. Finally, we will look at the Room library to analyze how we can persist data.
Chapter 12, Persisting Data, shows you the various ways to store data on a device, from SharedPreferences to files. The Repository concept will also be introduced, giving you an idea of how to structure your app in different layers.
Chapter 13, Dependency Injection with Dagger, Hilt, and Koin, explains the concept of dependency injection and the benefits it provides to an application. Frameworks such as Dagger, Hilt, and Koin are introduced to help you manage your dependencies.
Chapter 14, Coroutines and Flow, introduces you to doing background operations and data manipulations with coroutines and Flow. You’ll also learn about manipulating and displaying data using Flow operators and LiveData transformation.
Chapter 15, Architecture Patterns, explains the architecture patterns you can use to structure your Android projects to separate them into different components with distinct functionality. These make it easier for you to develop, test, and maintain your code.
Chapter 16, Animations and Transitions with CoordinatorLayout and MotionLayout, discusses how to enhance your apps with animations and transitions with CoordinatorLayout and MotionLayout.
Chapter 17, Launching Your App on Google Play, concludes this book by showing you how to publish your apps on Google Play: from preparing a release to creating a Google Play Developer account, and finally launching your app.
To get the most out of this book
Each great journey begins with a humble step. Before we can do awesome things in Android, we need to be prepared with a productive environment. In this section, we will see how to do that.
Minimum hardware requirements
For an optimal learning experience, we recommend the following hardware configuration:
- Processor: Intel Core i5 or equivalent or higher
- Memory: 8 GB RAM or more
- Storage: 8 GB available space minimum
Software requirements
You’ll also need the following software installed in advance:
- OS: 64-bit Windows 8/10/11, macOS, or 64-bit Linux
- Android Studio Electric Eel or higher
Installation and setup
Before you start this book, you will need to install Android Studio Electric Eel (or higher), which is the software you will be using throughout the chapters. You can download Android Studio from https://developer.android.com/studio.
On macOS, launch the DMG file and drag and drop Android Studio into the Applications folder. Once this is done, open Android Studio. On Windows, launch the EXE file. If you’re using Linux, unpack the ZIP file into your preferred location. Open your Terminal and navigate to the android-studio/bin/ directory and execute studio.sh.
Next, the Data Sharing dialog will pop up; click either the Send usage statistics to Google button or the Don’t send button to disable sending anonymous usage data to Google:
The Data Sharing dialog
In the Welcome dialog, click the Next button to start the...
Erscheint lt. Verlag | 2.5.2023 |
---|---|
Sprache | englisch |
Themenwelt | Mathematik / Informatik ► Informatik ► Programmiersprachen / -werkzeuge |
Informatik ► Software Entwicklung ► Mobile- / App-Entwicklung | |
ISBN-10 | 1-83763-980-9 / 1837639809 |
ISBN-13 | 978-1-83763-980-9 / 9781837639809 |
Informationen gemäß Produktsicherheitsverordnung (GPSR) | |
Haben Sie eine Frage zum Produkt? |
Digital Rights Management: ohne DRM
Dieses eBook enthält kein DRM oder Kopierschutz. Eine Weitergabe an Dritte ist jedoch rechtlich nicht zulässig, weil Sie beim Kauf nur die Rechte an der persönlichen Nutzung erwerben.
Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belletristik und Sachbüchern. Der Fließtext wird dynamisch an die Display- und Schriftgröße angepasst. Auch für mobile Lesegeräte ist EPUB daher gut geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür die kostenlose Software Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür eine kostenlose App.
Geräteliste und zusätzliche Hinweise
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich