Reputation: 462
I've tried to look for an answer to this, but no one seems to have asked it; and I find that strange, and makes me a little worried.
I've added the DatePicker widget to a layout. The screen I'm seeing it on is large enough for the calendar to show up to the right of it. The calendar's title is, for example, "July 2013". If I use the spinner to change the year, the calendar adjusts itself to the appropriate year.... but the label doesn't change. So, you could be looking at July of 2020, but the label would still read "July 2013". The only time that label/title/whatever seems to update is if you manually drag through the calendar, or change the month via the month spinner.
I've done virtually nothing so far besides adding it to the layout, so I'm not sure what I could be doing wrong, but this seems like a big enough bug (if it's NOT just me) that I should have been able to find SOMETHING else out about it.
Any help would be appreciated.
Upvotes: 2
Views: 728
Reputation: 1836
I had the same issue with the widget. It seems like the year on the label doesn't update unless you changed the year AND the month. There's probably some code in the widget's design that doesn't refresh the text of the label unless the month is changed, so if you change the year without the month, the label never refreshes (despite the rest of the widget being updated).
This seems to be a pretty glaring bug with the widget, so I'm a little surprised they haven't fixed it, unless we're missing something obvious here?
I actually got around the issue with my own code. I just needed the calender view, not the spinners, but the issue remains with the label if you only update the widget's year without the month. I basically just forced a +1 month increment regardless of if the situation called for it, refreshed the widget, then immediately decremented the month and refreshed the widget again. This way, your month remains the what it should have been, and the label refreshes the year if that was changed.
Upvotes: 2