What is the recommended way to launch a DialogFragment from a ViewModel?

前端 未结 5 1528
感情败类
感情败类 2020-12-06 06:40

I have a list objects in a Recyclerview. When long-pressing an item I want to show a dialog with data from the item clicked.

The Recyclerview

5条回答
  •  生来不讨喜
    2020-12-06 07:30

    I think using a binding adapter for a recyclerview and put the adapter n ViewModel, then make the viewmodel is the model of fragment and passing adapter for the setAdapter method in xml itself.

提交回复
热议问题