Hope I'm not too late :)
This is how I solved it, you need to make different values
folder with corresponding strings.xml
in it, keep in mind that I wanted to have latin as default so I use en
(just plain values folder) for that and cyrillic as a choice so its in ca
(values-ca folder) and so on...
public static void language(String s) {
switch (s) {
case "Srpski":
setLocale("en");
break;
case "Српски":
setLocale("ca");
break;
case "Hrvatski":
setLocale("hr");
break;
case "Македонски":
setLocale("mk");
break;
case "Slovenski":
setLocale("sl");
break;
}
}
public static void setLocale(String lang) {
// ctx is my Context
if (ctx == null) {
ctx = MainActivity.getContext();
}
Locale mLocale = new Locale(lang);
Locale.setDefault(mLocale);
Configuration mConfiguration = new Configuration();
mConfiguration.locale = mLocale; //DEPRECATED .locale
ctx.getResources().updateConfiguration(mConfiguration, ctx.getResources().getDisplayMetrics()); //DEPRECATED updateConfiguration
}