admin管理员组

文章数量:1131395

I have searched and found no answer why

AppCompatDelegate.getApplicationLocales()

returns [] (empty) It should have returned current language, which is nb-NO. I guess this is the reason the next command is not working either:

AppCompatDelegate.setApplicationLocales(LocaleListCompat.forLanguageTags("locale"));

I do use AppCompat theme which is required from this post.

I do call this in the main activity in an onItemClicked(). I have added all languages in build.gradle

android {
   resourceConfiguration += ["da-rDK", "de-rDE" (rest of languages)]
   }

I have added a locale_config.xml file and added it in AndroidManifest.xml

<application
    android:localeConfig="@xml/locale_config">

The strange thing is that I did a test app with just this functionality and it worked. But not when I add it into my other app.

本文标签: androidAppCompatDelegategetApplicationLocales() return Stack Overflow