- 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.
推薦閱讀
- FreeSWITCH 1.8
- Designing Hyper-V Solutions
- Visual C
- 用Python實現深度學習框架
- The Complete Coding Interview Guide in Java
- Unity UI Cookbook
- 動手學數據結構與算法
- 零基礎學C語言(升級版)
- Appcelerator Titanium:Patterns and Best Practices
- Learning C++ by Creating Games with UE4
- 你真的會寫代碼嗎
- Expert Cube Development with SSAS Multidimensional Models
- Mastering Magento Theme Design
- PHP程序設計經典300例
- OpenStack Sahara Essentials