I came across this in the viewbinding documentatio...
# android
s
I came across this in the viewbinding documentation.
Note: Fragments outlive their views. Make sure you clean up any references to the binding class instance in the fragment’s 
onDestroyView()
 method.
Does this mean that using
lazy
as below could potentially leak?
Copy code
private val binding: SomeXmlViewBinding by lazy {
    SomeXmlViewBinding.inflate(layoutInflater)
}

private val button: View by lazy { binding.button }
👌 2
i
Yep, consider using some of the approaches listed here: https://evan.tatarka.me/2020/03/02/you-dont-need-to-null-out-views.html
👍 1
👍🏼 6
😮 1
s
interesting article! thanks @Ian Lake