I have in my res\values\strings.xml a translation to Norwegian.
How can I use this file when the users language is Norwegian? I tried it on my mobile phone, and this language did not load.
My code:
public void setLanguage(){
// Get user language
String lang3 = Locale.getDefault().getISO3Language();
String lang2 = lang3.substring(0, 2);
Toast.makeText(this, lang2, Toast.LENGTH_LONG).show();
// Get recourse
Resources res = this.getResources();
// Change locale settings in the app.
DisplayMetrics dm = res.getDisplayMetrics();
android.content.res.Configuration conf = res.getConfiguration();
conf.setLocale(new Locale(lang3.toLowerCase())); // API 17+ only.
}