Code example for DatePickerDialog

0
	@Override 
	protected Dialog onCreateDialog(int id) {
		switch (id) {
		case DATE_DIALOG_ID:
			// set date picker as current date 
			return new DatePickerDialog(this, datePickerListener, year, month,
					day);
		} 
		return null; 
	} 
 
	private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() {
 
		// when dialog box is closed, below method will be called. 
		public void onDateSet(DatePicker view, int selectedYear, 
				int selectedMonth, int selectedDay) { 
			year = selectedYear; 
			month = selectedMonth; 
			day = selectedDay; 
 
			// set selected date into textview