Anyone stumble across ViewModel death during langu...
# android-architecture
d
Anyone stumble across ViewModel death during language change?
s
is onCleared being called?
d
Just checked and, yes
Do you have idea why this is called?
I debugged and in
FragmentActivity.onDestroy()
ViewModelStore
is not null by
mRetaining
is false so
mViewModelStore.clear()
is called. Do you know why
mRetaining
is false?
s
Are you using ViewModel or AndroidViewModel? AndroidViewModel has access to resources using Application.getResources()
d
ViewModel
s
@dawidhyzy This works fine for me, both ViewModel and AndroidViewModel
@dawidhyzy Try this https://github.com/Ethan1983/ViewModelConfigChange. I'm curious if you found the cause
d
Issue was caused by bug in Support Library 27.1.1
After update to 28 it works as supposed
s
Ah, gotcha