官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 仪陇县| 英吉沙县| 若尔盖县| 繁昌县| 彰化县| 行唐县| 五台县| 客服| 朝阳区| 荣昌县| 昭觉县| 江西省| 阜康市| 海盐县| 教育| 平南县| 玛纳斯县| 新兴县| 健康| 天镇县| 利津县| 五指山市| 商南县| 闻喜县| 永康市| 黄梅县| 玉林市| 神农架林区| 科技| 苍溪县| 鲁甸县| 宣武区| 囊谦县| 晋中市| 平凉市| 融水| 平顺县| 镇巴县| 文山县| 周宁县| 巴彦淖尔市|