Code example for GregorianCalendar

Methods: after, before, set

0
		 
		_datePicker.init(_init.get(Calendar.YEAR), _init.get(Calendar.MONTH), _init.get(Calendar.DAY_OF_MONTH), new DatePicker.OnDateChangedListener() {
 
				public void	onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
					//Logger.D(TAG, "onDateChanged( year="+String.valueOf(year)+", month="+String.valueOf(monthOfYear)+", day="+dayOfMonth); 
					Calendar new_date = new GregorianCalendar();
					Calendar set_to = null;
 
					new_date.set(Calendar.YEAR, year);
					new_date.set(Calendar.MONTH, monthOfYear);
					new_date.set(Calendar.DAY_OF_MONTH, dayOfMonth);
					new_date.set(Calendar.HOUR_OF_DAY, 0);
					new_date.set(Calendar.MINUTE, 0);
					new_date.set(Calendar.SECOND, 0);
					new_date.set(Calendar.MILLISECOND, 0);
 
					//Logger.D(TAG, "            new_date: year="+String.valueOf(new_date.getYear())+", month="+String.valueOf(new_date.getMonth())+", day="+new_date.getDay()); 
					 
					if (_min_time != 0) {
						//Logger.D(TAG, "            min_date: year="+String.valueOf(_min_Date.getYear())+", month="+String.valueOf(_min_Date.getMonth())+", day="+_min_Date.getDay()); 
						if (new_date.before(_min_Date)) {
							set_to = _min_Date;
						} 
					} 
					if (_max_time != 0) {
						//Logger.D(TAG, "            max_date: year="+String.valueOf(_max_Date.getYear())+", month="+String.valueOf(_max_Date.getMonth())+", day="+_max_Date.getDay()); 
						if (new_date.after(_max_Date)) {
							set_to = _max_Date;
						} 
					} 
					if (set_to != null) {
						view.updateDate(set_to.get(Calendar.YEAR), set_to.get(Calendar.MONTH), set_to.get(Calendar.DAY_OF_MONTH));