I defined layouts
for multiple languages and multiple devices like below:
I set proper layout
with custom language like bellow :
String languageToLoad = "ar";
Locale locale = new Locale(languageToLoad);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.setLocale(locale);
getBaseContext().getResources().updateConfiguration(config, null);
this.setContentView(R.layout.activity_main);
For language (ar - Arabic) I fetch layout-ldrtl
or layout-ldrtl-sw600dp
and other language (en - English) I fetch layout-ldltr
or layout-ldltr-sw600dp
and above code good work.
Problem : In this line getBaseContext().getResources().updateConfiguration(config, null);
say me updateConfiguration
is deprecated and then I use from createConfigurationContext
but when I use from this method the source don't work true and don't get me proper layout .