Localization does not work in Lollipop

I am developing an application that should be open directly in Portuguese, and inside this application it has the ability to change the language to English. Therefore, I have to change the language in the code. But when I tested my application in Lollipop, it immediately opens in English. In all other versions, except for lollipops, it works fine. Can someone help me or suggest me the steps that I should take to solve this problem. Thanks

Here is the code that I use for localization. Were any methods "discounted" from the candy?

public static Locale locale = new Locale("pt_BR"); Locale.setDefault(locale); android.content.res.Configuration config = new android.content.res.Configuration(); config.locale = locale; this.getResources().updateConfiguration(config, null); String locale = this.getResources().getConfiguration().locale .getDisplayName(); Log.i("System out", "(LogIn)Current Language : " + locale); 
+6
source share
1 answer

Due to some security issue -> java.lang.SecurityException: permission denied:

Changing the language does not work, try changing Locale locale = Locale ("en_US");
for the image Locale locale = Locale ("en", "US"); // Locale locale = Locale ("language", "country")

+4
source

Source: https://habr.com/ru/post/981853/


All Articles