Maximum date on Android DatePickerDialog

I need to set the maximum year on the DatePickerDialog I'm using, but I can't find any mechanism to do so. The document mentions getdatepicker() as the public method of DatePickerDialog. So, I think, maybe it can be used to get the datepicker, and then I can set the maximum date, but when I try to get the datepicker, I get the "method undefined" error

This is how I tried to get the datepicker in my oncreatedialog

DatePickerDialog d = new DatePickerDialog(this, dep_dateListener, mYear,
                      mMonth, mDay);
DatePicker dp = d.getDatePicker();
dp.setMaxDate(maxDate);
return d;

Any instructions on how to do this?

thank you

resolvent:

The getdatepicker () method is provided in API level 11

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>