Hello My project is MVVM architecture. I use dataB...
# android
j
Hello My project is MVVM architecture. I use dataBinding with ViewModel and View and ViewModel is AAC ViewModel. I know ViewModel must never reference a view, or it occur memory leak. When onClick called, I pass view by parameter. Although ViewModel doesn’t hold view, is it occured memory leak? android:onClick=“@{(v) -> viewmodel.onClick(v)}”
w
as long as you don’t save the view to aa property, it should be fine
Although it’s a good practice to keep the ViewModel completely free of android dependencies like Context or View
👍 5
j
Thank you :)