Hi everyone a question, I don't think it is mentio...
# android
a
Hi everyone a question, I don't think it is mentioned in the docs anywhere. When overriding ViewModel's onCleared is calling super.onCleared() required and what are possible consequences of not calling it , does anyone know?
g
Source Code seems like no consequences. Looks like a default implementation to prevent users from stubbing it out.
z
So the easiest would be just to check the sources 🙂 There you can notice that
onCleared()
is empty inside and its being called at the end of
clear()
method. So it’s just a callback to clear your own subscriptions.
a
@zalewski.se I did that , but then I checked other lifecycle super calls like onViewCreated etc and they are also all empty
But as we know they are required and that mentioned In the docs so not sure what's up there
i
Methods should be explicitly marked as
@CallSuper
if you need to call super
super.onViewCreated()
has never been a required call, hence why it doesn't have
@CallSuper
a
Ah ok I see it in onCreate for example
i
If you find any exceptions to that, please file a bug
👍 1
a
Thanks!