1

I want my app to have the functionality to change the language from within the app. The API Level of the app is 29 so I don't have access to the function updateConfiguration().

My goal with this function is to let users swap between the Dutch and English language, selected from a dropdown menu.

I tried to look for other ways to achieve this instead of updateConfiguration(), but most of the examples I came across were either in Kotlin, outdated or a little too 'vague' for me to implement it. So I was wondering, what is the best practice to implement the functionality to let users change the language from within the app itself?

JAMNESIA
  • 11
  • 1
  • Does this answer your question? [Change app language programmatically in Android](https://stackoverflow.com/questions/2900023/change-app-language-programmatically-in-android) – Catweazle Mar 31 '20 at 14:06
  • @Catweazle Sadly it does not, I can't use the function `updateConfiguration()` as it is deprecated as of API Level 25. My application runs on API Level 29 to implement dark mode in the future. – JAMNESIA Mar 31 '20 at 14:21
  • Check out the answer link mentioned by @Catweazle. The answer has updated code to change the language. – Nataraj KR Mar 31 '20 at 14:27
  • @NatarajKR I saw the updated code, the problem is that I can't use the function `updateConfiguration()` because it's deprecated in the API level that I'm currently using for the app. Is there a workaround for this problem? – JAMNESIA Mar 31 '20 at 14:36
  • @JAMNESIA, have you tried java locale? https://www.oracle.com/technical-resources/articles/javase/locale.html –  Apr 01 '20 at 08:38
  • @Jamnesia: this better? https://stackoverflow.com/questions/40221711/android-context-getresources-updateconfiguration-deprecated – Catweazle Apr 01 '20 at 08:55

0 Answers0