I am developing an app that uses text in 3 languages. English, Kurdish and Arabic. I am trying to change the layouts dynamically when user changes language. I have a settings screen where the user can change language that is I am not changing language from the system settings but from within my app. For example the layout should change from RTL to LTR if I switch from Kurdish to English or vice versa. I tried to use onConfiguterionchanged() but it is not getting triggered.
Changing locale: Force activity to reload resources? had the answer to the question.
I tried
Android: locale(system Language) change effect my application layouts.
Android Localization problem: Not all items in the layout update properly when switching locales,
without success.
I tried onResume() which gets triggered but the layout is not changed when the language is changed. I use the following code to change the locale. LocaleSingleton is a class that I created to hold an instance of Configuration.
@Override
protected void onResume() {
getResources().updateConfiguration(LocaleSingleton.getInstance().getConfig(), getResources().getDisplayMetrics());
AsyncData data = new AsyncData();
data.execute(String.valueOf(id), Constants.SERVER + "ad_detail.php");
super.onResume();
}
Any help is appreciated. Thanks in advance. Edit: I have also tried to restart the activity in onResume() but I get only a black screen. Thanks again.