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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.200.109