6

My users' calendar is Persian calendar. I have an algorithm to change date and time between western and Persian calendar. I want to use CalendarView or DatePicker for my users for selecting dates. Is it possible to localize CalendarView and DatePicker for supporting my local calendar?

Bob
  • 22,810
  • 38
  • 143
  • 225
Conscious
  • 1,603
  • 3
  • 18
  • 16
  • look at the sources! Should not be too difficult to do what you have in mind, but it will help tremendously if you know what happens under the hood of datepicker and calendarView! – Bondax May 01 '12 at 07:30
  • Can you explain more. I am new in Android. Thanks, – Conscious May 05 '12 at 04:50
  • Look at sources, which you can get at http://source.android.com/source/index.html. That way you'll find out how things work and find answers to many questions... – Bondax May 07 '12 at 06:37

2 Answers2

1

Yes, it is possible. But you shouldn't use default calender View. You should use Custom View with Google calender Api's. iff you use default calender View, Number's don't change and conntents also don't change, For changing the contents, you should use translate.google.com api's to change the content localization.

Naveen
  • 371
  • 3
  • 4
  • 14
0

The CalendarView uses the current locale to determine how dates shall be shown. It also implements onConfigurationChanged to listen for changes to the current locale and update the calendar. But it does not seem to support your scenario where you want to specify a different locale to be used (e.g., users' current locale is Persian and you want to show the calendar view with Western locale).

Unfortunately the setCurrentLocale method is private so even if you subclass CalendarView you won't be able to change the locale used.

You can see the Source code for CalendarView.

Praveenkumar
  • 24,084
  • 23
  • 95
  • 173
andyandy
  • 898
  • 8
  • 15