I wish to set my app to use value-th\string.xml (which i have all the string value in thai). This is what i will do. -app start. check sharepreference value language (in this case english/thai) if thai, i will run thai. I have this function, however, i notice in Locale, i do not have an options for thai.
public static void updateLanguageResources(Context context, String language) {
Locale locale = new Locale(language);
Locale.setDefault(locale);
Resources resources = context.getResources();
android.content.res.Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
}
I also tried use below code to change via settings. However, that will change the phone setting to thai, which my intention the change should only for my app. not the device's setting.
Intent intent = new Intent(Settings.ACTION_LOCALE_SETTINGS);
startActivity(intent);
Any suggestions are welcomed. Thanks in advance.