--

Yes, if you use Handler directly then you have to remove the callback when the activity gets stopped or destroyed.

You can create a helper method which uses a LifecycleOwner to remove the callback for you in onDestroy or onStop, without the need to launch a coroutine.

--

--

Christophe Beyls
Christophe Beyls

Written by Christophe Beyls

Android developer from Belgium, blogging about advanced programming topics.

Responses (1)