借助 Kotlin 协程,您可以简化 Android 应用中的异步编程,并以更有序的方式编写代码,而不是在代码中使用许多回调。如需详细了解协程的优势,请参阅开发者在线课程。此外,您还可以动手体验如何将协程集成到示例应用来处理一些常见用例。
了解如何使用 Kotlin 协程
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Learn how to use Kotlin coroutines\n\n\u003cbr /\u003e\n\nKotlin coroutines allow you to simplify asynchronous programming in your\nAndroid app. Instead of having many callbacks in your code, you can write\nyour code in a more sequential way.\n[Check out the pathway](/courses/pathways/android-coroutines) to learn more\nabout the benefits of coroutines. You will also get hands-on practice with\nintegrating coroutines into sample apps for common use cases.\n\n[Start pathway](/courses/pathways/android-coroutines)"]]