onConfigurationChange not called after changing locale

后端 未结 3 1679
心在旅途
心在旅途 2020-12-30 06:12

I have to refresh the fragments contents on change of language from one fragment. So I thought of using onConfigurationChange method which is in my Main activity (this activ

3条回答
  •  孤独总比滥情好
    2020-12-30 06:49

    For others who encounter this issue the OP was right but a bit unclear.
    You have to define android:configChanges="layoutDirection|locale" in order for onConfigurationChanged() to be called.
    I assume that this is necessary because locale change might also affect layout direction (for RTL languages) so declaring just locale might not be enough, yet this is only my assumption on this matter.

提交回复
热议问题