https://kotlinlang.org logo
#android-architecture
Title
# android-architecture
d

dawidhyzy

09/16/2018, 3:59 AM
Anyone stumble across ViewModel death during language change?
s

Sam

09/16/2018, 6:37 PM
is onCleared being called?
d

dawidhyzy

09/17/2018, 12:50 AM
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

Sam

09/17/2018, 2:07 AM
Are you using ViewModel or AndroidViewModel? AndroidViewModel has access to resources using Application.getResources()
d

dawidhyzy

09/17/2018, 2:34 AM
ViewModel
s

Sam

09/24/2018, 4:45 PM
@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

dawidhyzy

09/25/2018, 12:12 AM
Issue was caused by bug in Support Library 27.1.1
After update to 28 it works as supposed
s

Sam

09/25/2018, 12:17 AM
Ah, gotcha
4 Views