Following this answer, I'm using the following code in the onCreate()
method of each activity:
Resources res = context.getResources();
DisplayMetrics dm = res.getDisplayMetrics();
android.content.res.Configuration conf = res.getConfiguration();
conf.setLocale(newLocale);
res.updateConfiguration(conf, dm);
But this does not effectively update the configuration. The following problems need to be resolved:
The layout direction of the
dialogs
seems to be overridden by the system, which should have been handled byconf.setLocale(newLocale)
.The same is with some widgets such as
TimePicker
.Numbers in
NumberPicker
andTimePicker
are overridden as well.
What should be the effective approach here?