The snippet I showed you is a non anonymous Handle...
# android
l
The snippet I showed you is a non anonymous Handler class you can use without leaking your Activity. The host property is stored in a WeakReference using the delegate I shared earlier here: https://gist.github.com/LouisCAD/7ce3a30cb88c27858b12d5f26c118b0b You can then create an instance of this Handler in your Activity passing the Activity itself, or an anonymous class of the Activity as the
Host
, or any object tied to the Activity lifecycle (can also be instantiated there), without risking a memory leak since you're using a WeakReference