i'm trying to implement MVVM architecture + DataBinding + RxJava. i have an activity with RecyclerView. as i understand the ViewModel should not have a reference to the View. what's the correct way in MVVM to pass the data list from the ViewModel to the RecyclerView in the activity? pass the data via interface like in MVP?
You should add data binding to your ViewHolder. You can read some articles like this to make it more clear.
By the way I faced problem when using MVVM + Databinding Library when trying to apply animations or for example trying to implement postdelayed. Of course you can create tons of custom binding adapters, but it a lot easier to use view directly, so sometimes you have to use MVP like connections between ViewModel and View.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With