{ private var inflater: LayoutInflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { var binding: ViewDataBinding = DataBindingUtil.bind(itemView)!! } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { val view = inflater.inflate(R.layout.sample_list, parent, false) return ViewHolder(view) } override fun onBindViewHolder(holder: ViewHolder, position: Int) { holder.binding.setVariable(BR.text, getItem(position)) } companion object { val DIFF_CALLBACK = object : DiffUtil.ItemCallback<String>() { override fun areItemsTheSame(old: String, new: String): Boolean { return TextUtils.equals(old,new) } override fun areContentsTheSame(old: String, new: String): Boolean { return TextUtils.equals(old,new) } } } } SampleAdapter.kt lateinit var sampleListAdapter: SampleListAdapter override fun onCreate(savedInstanceState: Bundle?) { sampleListAdapter = SampleListAdapter(this) databinding.recyclerView.layoutManager = LinearLayoutManager(this) databinding.recyclerView.adapter = sampleListAdapter viewModel.sampleList.observe(this, Observer { sampleListAdapter.submitList(it) }) findViewById<View>(R.id.button).setOnClickListener({ viewModel.addList() }) } class MainViewModel { var counter: Int = 0 val sampleList: MutableLiveData<List<String>> = MutableLiveData() init { sampleList.postValue(arrayListOf()) } fun addList() { sampleList.postValue( IntProgression.fromClosedRange(0,counter,1).map { it -> "text" + it }.toList()) counter++ } } SampleActivity.kt MainViewModel.kt