Group Group Group Group Group Group Group Group Group Group Shape Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group Group
Skip to Content
  • v. Acknowledgments
  • More
    • NewsletterNewsletter
    • ForumsForums
Sign In
Create a free account
  • Search
  • Notebook
  • Customise
Pro

Kotlin Coroutines by Tutorials

Third Edition Kotlin 1.6, Android 12, Android Studio Bumblebee

Before You Begin

Section 0: 6 chapters
  • i. What You Need
  • ii. Book Source Code & Forums
  • iii. Dedications
  • iv. About the Team
  • v. Acknowledgments
    • Content Development
  • vi. Introduction
    • About Kotlin
    • About Coroutines
    • How to read this book

Section I: Introduction to Coroutines

Section 1: 9 chapters
  • 1. What Is Asynchronous Programming?
    • 1.1 Providing Feedback
    • 1.2 Why Multithreading?
    • 1.3 Interacting With the UI Thread From the Background
    • 1.4 Handling Work Completion Using Callbacks
    • 1.5 Indentation Hell
    • 1.6 Using Reactive Programming for Background Work
    • 1.7 Diving Deeper Into the Complexity of Rx
    • 1.8 A Blast From the Past
    • 1.9 Explaining Coroutines: The Inner Work
    • 1.10 Variations Through History
    • 1.11 Key Points
    • 1.12 Where to Go From Here?
  • 2. Setting Up Your Build Environments
    • 2.1 Choosing the Build Environments
    • 2.2 Installing the IntelliJ IDEA
    • 2.3 Installing the Android Environment
    • 2.4 Importing a Project
    • 2.5 Key Points
    • 2.6 Where to Go From Here?
  • 3. Getting Started With Coroutines
    • 3.1 Executing Routines
    • 3.2 Launching a Coroutine
    • 3.3 Building Coroutines
    • 3.4 Explaining Jobs
    • 3.5 Canceling Jobs
    • 3.6 Digging Deeper Into Coroutines
    • 3.7 Posting to the UI Thread
    • 3.8 Key Points
    • 3.9 Where to Go From Here?
  • 4. Suspending Functions
    • 4.1 Suspending vs. Non-Suspending
    • 4.2 Elaborating Continuations
    • 4.3 Creating Your Own Suspendable API
    • 4.4 Returning Values Using withContext
    • 4.5 Key Points
    • 4.6 Where to Go From Here?
  • 5. Async/Await
    • 5.1 The Async/Await Pattern
    • 5.2 Learning From the Past
    • 5.3 Using Async/Await
    • 5.4 Deferring Values
    • 5.5 Combining Multiple Deferred Values
    • 5.6 Being Cooperative and Structured
    • 5.7 Key Points
    • 5.8 Where to Go From Here?
  • 6. Coroutine Context
    • 6.1 Contextualizing Coroutines
    • 6.2 Providing Contexts
    • 6.3 Key Points
  • 7. Context Switch & Dispatching
    • 7.1 Work Scheduling
    • 7.2 Coroutine Dispatcher Types
    • 7.3 Using Dispatchers
    • 7.4 Key Points
  • 8. Exception Handling
    • 8.1 Exception Propagation
    • 8.2 CoroutineExceptionHandler
    • 8.3 Try-Catch to the Rescue
    • 8.4 Handling Multiple Child Coroutine Exceptions
    • 8.5 Callback Wrapping
    • 8.6 Supervising Coroutines
    • 8.7 Key Points
    • 8.8 Where to Go From Here?
  • 9. Manage Cancellation
    • 9.1 Cancelling a Coroutine
    • 9.2 Timing Out
    • 9.3 Key Points
    • 9.4 Where to Go From Here?

Section II: Channels & Flows

Section 2: 4 chapters
  • 10. Building Sequences & Iterators With Yield
    • 10.1 Getting Started With Sequences
    • 10.2 Enter: Sequence
    • 10.3 Generators & Sequences
    • 10.4 Yielding From SequenceScope
    • 10.5 Providing Values With Yield & YieldAll
    • 10.6 Key Points
    • 10.7 Where to Go From Here?
  • 11. Beginning With Coroutine Flow
    • 11.1 Streams of Data
    • 11.2 Limitations of Streams
    • 11.3 A New Approach to Streams
    • 11.4 Flow Constraints
    • 11.5 Key Points
    • 11.6 Where to Go From Here?
  • 12. SharedFlow & StateFlow
    • 12.1 Getting Started
    • 12.2 Sharing a Flow
    • 12.3 Building a StateFlow
    • 12.4 Key Points
    • 12.5 Where to Go From Here?
  • 13. Testing Coroutines
    • 13.1 Getting Started
    • 13.2 Writing Tests for Coroutines
    • 13.3 Setting Up the Test Environment
    • 13.4 Summing it up
    • 13.5 Key Points

Section III: Coroutines & Android

Section 3: 6 chapters
  • 14. Coroutines & Android
    • 14.1 The Importance of the Android Main Thread
    • 14.2 Getting Started
    • 14.3 Doing Heavy Work on UI Thread
    • 14.4 Thread
    • 14.5 Handler
    • 14.6 HandlerThread
    • 14.7 Executors
    • 14.8 RxJava
    • 14.9 Coroutines
    • 14.10 Key Points
    • 14.11 Where to Go From Here?
  • 15. Coroutines in the UI Layer
    • 15.1 Getting Started
    • 15.2 Introducing Lifecycle Scope
    • 15.3 Collecting Flows in the UI
    • 15.4 Key Points
    • 15.5 Where to Go From Here?
  • 16. Networking With Coroutines
    • 16.1 Getting Started
    • 16.2 Network Call With Callbacks
    • 16.3 Coroutine-Powered Networking
    • 16.4 Retrofit Meets Coroutines
    • 16.5 Key Points
    • 16.6 Where to Go From Here?
  • 17. Persistence & Coroutines
    • 17.1 Getting Started
    • 17.2 Suspending Database Calls
    • 17.3 Observing Database Changes
    • 17.4 Suspending Transactions
    • 17.5 Key Points
    • 17.6 Where to Go From Here?
  • 18. Coroutines & Jetpack
    • 18.1 Coroutines in ViewModels
    • 18.2 Comparing LiveData to Kotlin Flow
    • 18.3 Coroutines & Flow in Jetpack Compose
    • 18.4 Testing Coroutines on Android
    • 18.5 Key Points
    • 18.6 Where to Go From Here?
  • 19. Conclusion
Home Android & Kotlin Books Kotlin Coroutines by Tutorials

v
Acknowledgments

Content Development

We would like to thank Nishant Srivastava for his contributions as an author on the previous editions of this book.

vi. Introduction iv. About the Team

Have a technical question? Want to report a bug? You can ask questions and report bugs to the book authors in our official book forum here.

© 2022 Razeware LLC