转载于:http://q.cnblogs.com/q/42417/
代码如下:
datePicker.init(year,month,day,new OnDateChangedListener()
{
@Override
public void onDateChanged(DatePicker arg0,int year,int month,int day)
{
ChooseDate.this.year = year;
ChooseDate.this.month = month;
chooseDate.this.day = day;
showDate( year, month, day, hour, minute);
}
});
其中红色部分报错:
1、Multiple markers at this line
- ChooseDate cannot be resolved to
a type
2、The method showDate(int, int, int, int, int) is undefined for the type new DatePicker.OnDateChangedListener(){}
问题1的解决方法:ChooseDate应为类名,默认情况下应是MainActivity
问题2的解决方法:showDate为自定义的函数,后面自定义即可。