Show Dialog from ViewModel in Android MVVM Architecture

后端 未结 3 811
隐瞒了意图╮
隐瞒了意图╮ 2020-12-13 04:24

About MVVM with new architecture components, I\'ve a question, how should I implement if my app needs to display for example a Dialog with 3 options from some action that ha

3条回答
  •  情深已故
    2020-12-13 05:17

    As everyone says ViewModel should not contain Context or reference to classes that contain Context. So it is not a good idea to show dialog from ViewModel. You should show dialog from view, not from viewmodel.

提交回复
热议问题