AppCompatDelegate.setApplicationLocales() restarts activity when switching from system default to any other language despite configuration handling

2 weeks ago 23
ARTICLE AD BOX

This is expected bhehavior when using AppCompatDelegate.setApplicationLocales() and not a bug in you configuration.

xml android:configChanges="locale|layoutDirection"

the activtiy will still be recreated when switching from system default to custom locale.

This happen becuase of setApplicationLocales() update locale at the application level, not just the activity configuration.Internally, it forces a resourece rebinding and triggers activity recreation to correct apply localized resources.

Key Point:

ConfigChanges Cannot prevent recreation caused by AppCompatDelegate

Read Entire Article