- Learning Concurrency in Kotlin
- Miguel Angel Castiblanco Torres
- 99字
- 2021-08-05 10:46:50
Creating an asynchronous function to hold the request... or not
Currently, a big part of our code to request and display the number of news is inside the onCreate() function. This is less than optimal, not only because it's mixed with the creation of the activity, but also because it prevents reusing this code. For example, if there were to be a refresh button, we would need to reuse all the code of the coroutine.
When considering the separation of this coroutine into its own function, there are many possible approaches. Here, we will cover the most common ones.
推薦閱讀
- OpenDaylight Cookbook
- Boost C++ Application Development Cookbook(Second Edition)
- Python 深度學習
- Access 數據庫應用教程
- Java從入門到精通(第5版)
- C/C++常用算法手冊(第3版)
- Spring Cloud、Nginx高并發核心編程
- Reactive Programming With Java 9
- C語言實驗指導及習題解析
- SharePoint Development with the SharePoint Framework
- Node.js:來一打 C++ 擴展
- 匯編語言編程基礎:基于LoongArch
- Mastering Unreal Engine 4.X
- 你好!Java
- 透視C#核心技術:系統架構及移動端開發