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

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.

主站蜘蛛池模板: 平山县| 宝山区| 怀远县| 茌平县| 新巴尔虎左旗| 普陀区| 望谟县| 象州县| 武鸣县| 鄂尔多斯市| 新建县| 绥阳县| 高清| 清徐县| 仁怀市| 绿春县| 滕州市| 克东县| 浦城县| 东阿县| 甘肃省| 通州市| 彭阳县| 枣阳市| 芒康县| 平山县| 同江市| 江门市| 南岸区| 渝北区| 竹山县| 濮阳县| 泰安市| 吉隆县| 宁国市| 嘉善县| 新闻| 锦屏县| 苍梧县| 沈阳市| 清河县|