I have an activity where I programmatically set the locale to "de", and it does not work properly and displays the default language (English text), which is set manually. Please, help
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Programmatically sets the locale and language Locale locale = new Locale("de"); Locale.setDefault(locale); Configuration config = new Configuration(); config.locale = locale; getBaseContext().getResources().updateConfiguration(config,getBaseContext().getResources().getDisplayMetrics()); Toast.makeText(getApplicationContext(),Locale.getDefault().getDisplayLanguage(),Toast.LENGTH_LONG).show(); setContentView(R.layout.main); Intent intent=new Intent(LatestLocalizationActivity.this,AnotherActivity.class); startActivity(intent); }
source share