July 2018
Intermediate to advanced
266 pages
7h 11m
English
Before we can continue, we will need to update the logic that we implemented in ArticleAdapter. What we want to do is remove the code related to the ArticleLoader, since this implementation will not load on demand. First, let's update the constructor so that it doesn't take an ArticleAdapter:
class ArticleAdapter : RecyclerView.Adapter<ArticleAdapter.ViewHolder>() { ...}
Now we can update the function onBindViewHolder() so that it doesn't try to load more articles when needed. The updated implementation looks as follows:
override fun onBindViewHolder(holder: ViewHolder, position: Int) { val article = articles[position] holder.feed.text = article.feed holder.title.text = article.title holder.summary.text = article
Read now
Unlock full access