Simplifying Android Development with Coroutines and Flows: Learn how to use Kotlin coroutines and the flow API to handle data streams asynchronously in your Android app
Book information
Description
Get to grips with asynchronous programming in Android using simple, modern, and testable code through Kotlin coroutines and flow Key FeaturesFind out how to improve app performance with Kotlin coroutinesDiscover the new recommended ways to use Kotlin coroutines and flowsLearn the basics of asynchronous programming, along with an overview of coroutines and flowBook Description Coroutines and flows are the new recommended way for developers to carry out asynchronous programming in Android using simple, modern, and testable code. This book will teach you how coroutines and flows work and how to use them in building Android applications, along with helping you to develop modern Android applications with asynchronous programming using real data. The book begins by showing you how to create and handle Kotlin coroutines on Android. You’ll explore asynchronous programming in Kotlin, and understand how to test Kotlin coroutines. Next, you'll learn about Kotlin flows on Android, and have a closer look at using Kotlin flows by getting to grips with handling flow cancellations and exceptions and testing the flows. By the end of this book, you'll have the skills you need to build high-quality and maintainable Android applications using coroutines and flows. What you will learnUnderstand how coroutines and flows differ from existing waysApply asynchronous programming in Android with coroutines and flowsFind out how to build your own coroutines and flows in AndroidHandle, manipulate, and combine data in coroutines and flowsHandle cancellations and exceptions from coroutines and flowsDiscover how to add tests for your coroutines and flowsIntegrate coroutines and flows into your Android projectsWho this book is for This book is for intermediate-level Android developers who want to level up their Android app-building skills. Familiarity with Android development and basic knowledge of Kotlin are needed to make the most of this book. Table of ContentsIntroduction to Asynchronous Programming in AndroidUnderstanding Kotlin CoroutinesHandling Coroutine Cancelations and ExceptionsTesting Kotlin CoroutinesUsing Kotlin FlowsHandling Flow Cancelations and ExceptionsTesting Kotlin Flows Cover Title Copyright and Credits Foreword Table of Contents Part 1 – Kotlin Coroutines on Android Chapter 1: Introduction to Asynchronous Programming in Android Technical requirements Understanding asynchronous programming Exploring threads, AsyncTasks, and Executors Threads Callbacks AsyncTask Executors The new way to do it – coroutines and flows Kotlin coroutines Kotlin flows Summary Further reading Chapter 2: Understanding Kotlin Coroutines Technical requirements Creating coroutines in Android Exploring coroutine builders, scopes, and dispatchers Coroutine builders Coroutine scopes Coroutine dispatchers Understanding coroutine contexts and jobs Coroutine contexts Coroutine jobs Exercise – using coroutines in an Android app Summary Chapter 3: Handling Coroutine Cancellations and Exceptions Technical requirements Canceling coroutines Exercise 3.01 – canceling coroutines in an Android app Managing coroutine timeouts Catching exceptions in coroutines Exercise 3.02 – catching exceptions in your coroutines Summary Chapter 4: Testing Kotlin Coroutines Technical requirements Setting up an Android project for testing coroutines Unit testing suspending functions Testing coroutines Exercise 4.01 – adding tests to coroutines in an Android app Summary Further reading Part 2 – Kotlin Flows on Android Chapter 5: Using Kotlin Flows Technical requirements Using Flows in Android Creating Flows with Flow builders Using operators with Flows Collecting Flows with terminal operators Transforming Flows with Intermediate operators Buffering and combining flows Buffering Kotlin Flows Combining Flows Exploring StateFlow and SharedFlow Exercise 5.01 – Using Kotlin Flow in an Android app Summary Chapter 6: Handling Flow Cancellations and Exceptions Technical requirements Canceling Kotlin Flows Retrying tasks with Flow Catching exceptions in Flows Handling Flow completion Exercise 6.01 – Handling Flow exception in an Android app Summary Chapter 7: Testing Kotlin Flows Technical requirements Setting up an Android project for testing Flows Testing Kotlin Flows Testing Flows with Turbine Exercise 7.01 – Adding tests to Flows in an Android app Summary Index
Similar books
How to Build Android Apps with Kotlin: A practical guide to developing, testing, and publishing your first Android apps, 2nd Edition
EPUB
How to Build Android Apps with Kotlin: A practical guide to developing, testing, and publishing your first Android apps
2023 · PDF
Simplifying Android Development with Coroutines and Flows: Learn how to use Kotlin coroutines and the flow API to handle data streams asynchronously in your Android app
2022 · RAR
Simplifying Android Development with Coroutines and Flows: Learn how to use Kotlin coroutines and the flow API to handle data streams asynchronously in your Android app
2022 · EPUB
How to Build Android Apps with Kotlin: A hands-on guide to developing, testing, and publishing your first apps with Android. Code
2021 · ZIP
How to Build Android Apps with Kotlin: A hands-on guide to developing, testing and publishing your first apps with Android
2021 · PDF
MySQL® Notes for Professionals book
2018 · PDF
MrExcel 2022: Boosting Excel
2022 · PDF