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
wasyl
10/21/2019, 12:23 PM
as long as you don’t save the view to aa property, it should be fine
wasyl
10/21/2019, 12:23 PM
Although it’s a good practice to keep the ViewModel completely free of android dependencies like Context or View