Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DatePickerDialog in arabic language

I have an application in Arabic and I want to view the DatePickerDialog in Arabic.

I have tried setting "Locale" but that didn't work.

Thanks

like image 570
Abuzaid Avatar asked Oct 30 '22 04:10

Abuzaid


1 Answers

I found the answer is to change the "Locale" of the whole app to "ar" At your starting activity set your application Locale to "ar" by below code and all views and dialogs will be switched to Arabic.

    Locale locale = new Locale("ar");
    Locale.setDefault(locale);
    Configuration config =
            getBaseContext().getResources().getConfiguration();
    config.setLocale(locale);
    createConfigurationContext(config);
like image 50
Abuzaid Avatar answered Nov 09 '22 06:11

Abuzaid