Skip to content

Instantly share code, notes, and snippets.

@etonotieno
Created January 28, 2019 09:07
Show Gist options
  • Select an option

  • Save etonotieno/564d1c1d308f4f9a88c37cf47f90001d to your computer and use it in GitHub Desktop.

Select an option

Save etonotieno/564d1c1d308f4f9a88c37cf47f90001d to your computer and use it in GitHub Desktop.
class NewsAdapter : ListAdapter<News, NewsViewHolder>(COMPARATOR){
override fun onCreateViewHolder(parent :ViewGroup, viewType :Int) : NewsViswHolder{
val binding :ItemLayoutBinding = DataBindingUtil.inflate(layoutInflater, R.layout.item_layout, parent, false)
return NewsViewHolder(binding)
}
override fun onBindViewHolder(holder :NewsViewHolder, position :Int{
holder.binding.newsArticle = getItem(position)
}
}
class NewsViewHolder(val binding :ItemLayoutBinding) : RecyclerView.ViewHolder(binding.root)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment