我使用的 API 11 更高,在隐藏未来日期期间出现了一些问题:
@Override
    protected Dialog onCreateDialog(int id) {
        Calendar c = Calendar.getInstance();
        int cyear = c.get(Calendar.YEAR);
        int cmonth = c.get(Calendar.MONTH);
        int cday = c.get(Calendar.DAY_OF_MONTH);
        switch (id) {
        case DATE_DIALOG_ID:
            DatePickerDialog dialog = new DatePickerDialog(this, mDateSetListener, cyear, cmonth, cday);
            dialog.getDatePicker().setMaxDate(new Date());
            return dialog;
            /*return new DatePickerDialog(this, mDateSetListener, cyear, cmonth,
                    cday);*/
        }
        return null;
    }
我有问题:setMaxDate(new Date());
我收到此错误:
The method setMaxDate(long) in the type DatePicker is not applicable for the arguments (Date)
所以,请如何隐藏未来的日期。