0

The button order on all DatePickerDialog in my app isn't affected by the device's locale. If, for example, I change my locale to a right-to-left aligned language, such as Hebrew or Arabic, the button order on all other apps on my device automatically changes but remains the same on my own app! Why is that? And how can I tell my app to "adapt" to the newly selected locale and change the button order accordingly? This is driving me crazy. Any help or hint you can provide will be greatly appreciated. Thanks...

Rony Rozen
  • 3,957
  • 4
  • 24
  • 46

1 Answers1

0

You can use getDefault() to get an appropriate locale for the user of the device you're running on. Then try to apply the locale to the config.

Locale locale = Locale.getDefault();
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config,getBaseContext().getResources().getDisplayMetrics());

I don't know if the code snippet above works on your case. But you might give it a try.

stuckedunderflow
  • 3,551
  • 8
  • 46
  • 63