I've an android app with possibility to choose it's language on the main screen (there are a lot of languages including English as default). But starting from Android 7 (when LocaleList appeared) i got a bug: one part of strings is in one language and another part is in the other language.
Example: 1. In Android's language settings are chosen French (as system default) and English; 2. In the app i choose English language; 3. As a result, the whole app's strings are divided into two parts: the first is in English (mostly content, some menu's etc), the second is in French (most of the titles, some drop-down menus, some words in content);
I've got in my BaseActivity overridden onConfigurationChanged method, where i set the user's preferred language (stored in my LanguageManager's static field) as the default locale, which was working well before Android 7 (this was necessary to avoid language change to Android system's after screen rotation).
I've tried to change LocaleList at any possible time to store only the user's preferred language. But it gets updated from Android's system, containing all languages selected in Android's language settings with the system's language in the first place. LocaleList.setDefault doesn't work here.
I've tried to implement all possible solutions found with google like the following ones and nothing worked for me:
- https://proandroiddev.com/change-language-programmatically-at-runtime-on-android-5e6bc15c758
- https://gist.github.com/amake/0ac7724681ac1c178c6f95a5b09f03ce
- Android N change language programmatically
In general, my code implements all localization techniques and was working well before LocaleList appeared (except for rotating screen). So, how i see the problem: somewhere in Android's code there is a system locale (list) stored, which is being used all the time. That's why all my intentions to change things has no success.