0

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:

  1. The layout direction of the dialogs seems to be overridden by the system, which should have been handled by conf.setLocale(newLocale).

  2. The same is with some widgets such as TimePicker.

  3. Numbers in NumberPicker and TimePicker are overridden as well.

What should be the effective approach here?

Community
  • 1
  • 1
Piyush
  • 1,744
  • 1
  • 15
  • 28

1 Answers1

0

Seems a bit too early to post an answer to my question, but adding Locale.setDefault(newLocale) to the code above solves all the three problems mentioned.

Piyush
  • 1,744
  • 1
  • 15
  • 28