Skip to content

Instantly share code, notes, and snippets.

@sandipsavaliya112
Created June 9, 2020 08:28
Show Gist options
  • Save sandipsavaliya112/4ac587ce599a712473d22e516fff3897 to your computer and use it in GitHub Desktop.
Save sandipsavaliya112/4ac587ce599a712473d22e516fff3897 to your computer and use it in GitHub Desktop.
val items = ArrayList<BaseModel>()
items.add(Trip().apply { from = "NewYork"; to = "Chicago"})
items.add(Trip().apply { from = "London"; to = "Pennsylvania"})
items.add(Progress())
binding.recyclerView.adapter = Adapter(items){ holder, model ->
when(holder.binding){
is ItemTripBinding -> holder.binding.item = model as Trip
is ProgressBinding -> holder.binding.item = model as Progress
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment