Set default Locale to DatePicker and TimePicker
You need to create your custom DatePicker or TimePicker . See this link https://stackoverflow.com/a/9220899/3864698. It can help you to solve your problem.
Or you can use Reflection to edit the NumberPicker values, follow this link for the complete solution.
Abdallah Alaraby
I have a very strong passion towards solving programming problems in general. I've spent some time exploring the beauty of different technologies and programming languages. But I decided to take the path of Android development.
Updated on July 30, 2022Comments
-
Abdallah Alaraby almost 2 years
I'm using a
DatePicker
and aTimePicker
in a customDialog
. The functionality works fine, but I have a problem when I change the defaultLocale
of the app to match the Arabic language.The problem is that the
DatePicker
andTimePicker
are not localized on all Android versions. It works on Android versions 4.2.2 and higher. But It doesn't work on Android versions 4.1.2 And lower.I want to either change localization of
DatePicker
andTimePicker
to English all the time, Or to change it to Arabic when theLocale
matches the Arabic language.This is the dialog in Android versions 4.2.2 and higher (the correct one that matches the localization)
And this is the dialog in Android versions 4.1.2 and lower
-
Abdallah Alaraby over 9 yearsIs there a way to change the Months strings in the DatePicker instead of creating a custom one?
-
QArea over 9 yearsI see that you found some solution. In other case unfortunately i don't see any possibility to do it. Here link to customize your DatePicker stackoverflow.com/a/25486882/3864698
-
Abdallah Alaraby over 9 yearsThis is very useful, Thanks
-
Sagar over 5 years@AbdallahAlaraby any solution for this without custom?