I have recently learned to use data binding with recyclerView in android. I need to make some network calls on the click of a button at the recyclerView, and based on response I need to update my UI. All my code for the view is in my ViewHolder. Bt all the code for my network calls are in repository which is accessed by my viewModel. how can I make the network calls from the viewHolder?

  • 1
    Use interface to connect the adapter and the viewmodel
  • 0
    thanks, I was hoping if there was a direct way to call from the viewHolder rather than using callbacks.
Add Comment