private boolean isDateTrue(int flag) { int maxDay=31; switch(flag) { case YEAR: year2 = Integer.parseInt(dqrq1_nian.getText().toString()); if(year2<2100&&year2>1980) return true; else return false; case MONTH: month2 = Integer.parseInt(dqrq1_yue.getText().toString()); if(month2<=12&&month2>0) return true; else return false; case DAY: day2 = Integer.parseInt(dqrq1_ri.getText().toString()); if(month2==4||month2==6||month2==9||month2==11) maxDay=30; else if(month2==1||month2==3||month2==5||month2==7||month2==8||month2==10||month2==12) maxDay=31; else if(month2==2) { if( ( ((year2%4==0)&&(year2%100==0))||(year2%400==0) ) ) maxDay=29; else maxDay=28; } if(day2<=maxDay&&day2>0) return true; else return false; case HOUR: hour2 = Integer.parseInt(dqsj1_shi.getText().toString()); if(hour2<24&&hour2>=0) return true; else return false; case MINUTE: minute2 = Integer.parseInt(dqsj1_fen.getText().toString()); if(minute2<60&&minute2>=0) return true; else return false; case SECOND: second2 = Integer.parseInt(dqsj1_miao.getText().toString()); if(second2<60&&second2>=0) return true; else return false; } return false; }