My application supports for 2 languages- Spanish and English. When a user selects his preferred language from settings, the application changes to the user preferred language. It is working fine as expected. But recently encountered an issue where switching between some another installed application(In my case an app VUFORIA SPARK)application changing the behaviour of my application. I can sense that my locale is being overridden by this SPARK application. When my app is in Spanish >> switching to SPARk and back to my application changing the language to English.
Programmatically I am handling application using Locale configuration changes and setting language. Assuming this SPARK is somewhere setting their app to English is affecting my application. Can please anyone help me out how to not override my application configuration
public void setApplicationLanguage(Context context, String newLanguage) {
Resources activityRes = context.getResources();
Configuration activityConf = activityRes.getConfiguration();
Locale newLocale = new Locale(newLanguage,
Locale.getDefault().getCountry());
activityConf.setLocale(newLocale);
activityRes.updateConfiguration(activityConf,
activityRes.getDisplayMetrics());
Resources applicationRes =
context.getApplicationContext().getResources();
Configuration applicationConf = applicationRes.getConfiguration();
applicationConf.setLocale(newLocale);
applicationRes.updateConfiguration(applicationConf,
applicationRes.getDisplayMetrics());
}
Thanks in advance