F
F
foonfyrick2021-01-07 16:06:29
Android
foonfyrick, 2021-01-07 16:06:29

Do I need to unsubscribe from observers and remove links when the activity is destroyed, or is everything done by itself?

And what else needs to be done when the activity is destroyed so that the garbage collector works correctly?
I sometimes hear that you need to unsubscribe observers, but what else is needed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2021-01-08
@foonfyrick

Yes, in onDestroy it is better to unsubscribe everything that has been signed up to this point. You need to release all the resources that potentially live longer than the activity.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question