开发者

How can I limit the BB DateTimePicker?

I use a DateTimePicker in my app and I want it to allow to select only past dates, I use it to allow the user to select his date of birth and I would like it to start and 开发者_JAVA技巧end at a given year.


Well, a quick look at the DateTimePicker documentation shows that you use the setDateTime, setMaximumDate and setMinimumDate methods to set the timespans and initial date.


I managed to solve this the following way:

Calendar minDate = Calendar.getInstance();
minDate.set(Calendar.DAY_OF_MONTH, 1);
minDate.set(Calendar.MONTH, Calendar.JANUARY);
minDate.set(Calendar.YEAR, 1920);

_datePicker.setMinimumDate(minDate);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜