July 2018
Intermediate to advanced
266 pages
7h 11m
English
Since we moved much of the code in MainActivity to ArticleProducer, we now only have onCreate() and asyncLoadNews() in it. We will delete asyncLoadNews() first – along with the call to it that was being made in onCreate() – and then we will update the signature of the activity so that it implements ArticleLoader:
class MainActivity : AppCompatActivity(), ArticleLoader { ...}
Now we will need to implement the suspending function loadMore(). Let's begin by having it retrieve the producer from ArticleProducer and keeping a reference to it in a variable:
override suspend fun loadMore() { val producer = ArticleProducer.producer}
Now that we have access to the producer, we need to validate that the producer ...
Read now
Unlock full access