Code example for DatePicker

Methods: getDayOfMonthgetMonthgetYearupdateDate

			if (null == foodDate) 
				foodDate = Calendar.getInstance();
			foodDate.set(datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth(), 0, 0, 0); 
			// update xml file 
			FoodInfo foodInfo = new FoodInfo(foodName, foodDate);
			// set new alarm 
			FoodReceiver alarm = new FoodReceiver(EditEntry.this, foodDate, true);
			// popup toast confirming the submit 
			showMsg("Reminder added."); 
			// clear foodName & foodDate to avoid problems if user want to sumbit several items in a row 
			foodName = null; 
			foodDate = null; 
			// clear widgets 
			datePicker.updateDate(currentDate.get(Calendar.YEAR), currentDate.get(Calendar.MONTH), currentDate.get(Calendar.DAY_OF_MONTH));
		private void showMsg(String msg)
			Toast.makeText(EditEntry.this, msg, Toast.LENGTH_SHORT).show();
Experience pair programming with AI  Get Codota for Java