how to use Architecture Components ViewModel inside RecyclerView Adapter?

前端 未结 3 2006
慢半拍i
慢半拍i 2021-02-02 08:16

I have multiple ViewHolders that work as separated views inside a vertical RecyclerView. I\'m practicing with the new Architecture Components ViewModel.

Inside my ViewMo

3条回答
  •  攒了一身酷
    2021-02-02 08:46

    You could create an OnClickListener interface instead, then implement the onClick method (defined in your interface) in your fragment or activity where you have access to your view model.

提交回复
热议问题