Hi, in this snippet I'm creating an observer class and adding it as an observer to the first activit...
s
Hi, in this snippet I'm creating an observer class and adding it as an observer to the first activity. Then navigating to another activity with finishing first activity. My question is, Shouldn't there be a leak here bacause of not removing the observer ? I used leakcanary and it can't find anything about leak
✔️ 1
not kotlin but kotlin colored 6
i
Lifecycle removes all observers for you when the Lifecycle is destroyed. This feature was added in Lifecycle 2.5.0-alpha03 so it has been the case for about a year and a half now: https://developer.android.com/jetpack/androidx/releases/lifecycle#2.5.0-alpha03
s
@Ian Lake Very appreciated. Thanks.