Best code examples for Android DatePicker class (android.widget.DatePicker)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android DatePicker class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android DatePicker examples from Open Source projects
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear, setMaxDate, setMinDate
27:	int currentYear = picker.getYear(); 
28:	int currentMonth = picker.getMonth(); 
29:	int currentDayOfMonth =  picker.getDayOfMonth(); 
30:	picker.updateDate(maxCal.get(Calendar.YEAR), 
-
33:	picker.setMinDate(minCal.getTimeInMillis()); 
34:	picker.updateDate(minCal.get(Calendar.YEAR), 
-
37:	picker.setMaxDate(maxCal.getTimeInMillis()); 
-
41:	picker.updateDate(currentYear, currentMonth, currentDayOfMonth); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear
145:	this.v.set(this.dp.getYear(), this.dp.getMonth(), this.dp.getDayOfMonth()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: clearFocus, getDayOfMonth, getMonth, getYear
110:	mDatePicker.clearFocus(); 
111:	mCallBack.onDateTimeSet(mDatePicker, mTimePicker, mDatePicker.getYear(), 
112:	mDatePicker.getMonth(), mDatePicker.getDayOfMonth(), 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: clearFocus, getDayOfMonth, getMonth, getYear
43:	picker.clearFocus(); // focus must be cleared so the value change listener is called 
44:	callback.onDateSet(picker, picker.getYear(), picker.getMonth(), picker.getDayOfMonth()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear
334:	DatePicker datePicker = new DatePicker( null ); 
-
336:	androidWidgetBuilder.setValue( date, datePicker ); 
337:	assertEquals( 1975, datePicker.getYear() ); 
338:	assertEquals( 4, datePicker.getMonth() ); 
339:	assertEquals( 9, datePicker.getDayOfMonth() ); 
340:	assertEquals( 75, ( (Date) androidWidgetBuilder.getValue( datePicker ) ).getYear() ); 
341:	assertEquals( 4, ( (Date) androidWidgetBuilder.getValue( datePicker ) ).getMonth() ); 
342:	assertEquals( 9, ( (Date) androidWidgetBuilder.getValue( datePicker ) ).getDate() ); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: clearFocus, getDayOfMonth, getMonth, getYear
125:	mDatePicker.clearFocus(); 
126:	mCallBack.onDateTimeSet(mDatePicker, mTimePicker, mDatePicker.getYear(), 
127:	mDatePicker.getMonth(), mDatePicker.getDayOfMonth(), 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: clearFocus, getDayOfMonth, getMonth, getYear
60:	mDatePicker.clearFocus(); 
61:	onDateChanged(mDatePicker, mDatePicker.getYear(), mDatePicker.getMonth(), 
62:	mDatePicker.getDayOfMonth()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear
38:	int year = mDate.getYear(); 
39:	int month = mDate.getMonth(); 
40:	int dayOfMonth = mDate.getDayOfMonth(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear, init
100:	view.init(mCalendar.get(Calendar.YEAR),mCalendar.get(Calendar.MONTH),mCalendar.get(Calendar.DAY_OF_MONTH), this); 
-
103:	view.init(year, month, day, null); 
-
150:	tempCalendar.set(tempView.getYear(), tempView.getMonth(),tempView.getDayOfMonth(), 0, 0, 0); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear, setMaxDate, setMinDate
27:	int currentYear = picker.getYear(); 
28:	int currentMonth = picker.getMonth(); 
29:	int currentDayOfMonth =  picker.getDayOfMonth(); 
30:	picker.updateDate(maxCal.get(Calendar.YEAR), 
-
33:	picker.setMinDate(minCal.getTimeInMillis()); 
34:	picker.updateDate(minCal.get(Calendar.YEAR), 
-
37:	picker.setMaxDate(maxCal.getTimeInMillis()); 
-
41:	picker.updateDate(currentYear, currentMonth, currentDayOfMonth); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setCalendarViewShown
58:	picker.setCalendarViewShown(isChecked); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setEnabled
363:	_datePicker.setEnabled(v); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear
71:	int day = (int) wodDay.getDayOfMonth(); 
72:	int month = (int) wodDay.getMonth() + 1; 
73:	int year = (int) wodDay.getYear(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: clearFocus, getDayOfMonth, getMonth, getYear
209:	datePicker.clearFocus(); 
210:	onDateChanged(datePicker, datePicker.getYear(), datePicker.getMonth(), 
211:	datePicker.getDayOfMonth()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear
84:	cal.set(picker.getYear(), picker.getMonth(), picker.getDayOfMonth()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: clearFocus, getDayOfMonth, getMonth, getYear
110:	mDatePicker.clearFocus(); 
111:	mCallBack.onDateTimeSet(mDatePicker, mTimePicker, mDatePicker.getYear(), 
112:	mDatePicker.getMonth(), mDatePicker.getDayOfMonth(), 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear
30:	year = dp.getYear(); 
31:	month = dp.getMonth(); 
32:	dayOfMonth = dp.getDayOfMonth(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear
60:	Date eDate = new Date(endDate.getYear() - 1900, endDate.getMonth(), 
61:	endDate.getDayOfMonth() + 1); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: clearFocus, getDayOfMonth, getMonth, getYear
210:	datePicker.clearFocus(); 
211:	onDateChanged(datePicker, datePicker.getYear(), datePicker.getMonth(), 
212:	datePicker.getDayOfMonth()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear
58:	Date sDate = new Date(startDate.getYear() - 1900, startDate.getMonth(), 
59:	startDate.getDayOfMonth()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, updateDate
53:	dp.updateDate(Calendar.getInstance().get(Calendar.YEAR), dp.getMonth(), dp.getDayOfMonth()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setFocusable, init, setEnabled
59:	mDatePicker.init(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH), 
-
80:	mDatePicker = new DatePicker(getContext()); 
-
82:	mDatePicker.setFocusable(true); 
83:	mDatePicker.setEnabled(true); 
-
113:	mDatePicker.init(d.getYear() + YEARSHIFT, d.getMonth(), d.getDate(), mDateListener); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: clearFocus, getDayOfMonth, getMonth, getYear
128:	mDatePicker.clearFocus(); 
-
130:	.onDateSet(mDatePicker, mDatePicker.getYear(), mDatePicker.getMonth(), mDatePicker.getDayOfMonth()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear, init
57:	dYear = datePicker.getYear(); 
58:	dMonth = datePicker.getMonth(); 
59:	dDay = datePicker.getDayOfMonth(); 
-
69:	datePicker.init(dYear, dMonth, dDay, this); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: init, getClass
39:	DatePicker datePicker = new DatePicker(context); 
-
44:	datePicker.init(year, month, date, null); 
-
49:	Method m = datePicker.getClass().getMethod("setCalendarViewShown", boolean.class); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear
32:	calendar.set(datePicker.getYear(), datePicker.getMonth(), 
33:	datePicker.getDayOfMonth(), timePicker.getCurrentHour(), 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: clearFocus, getDayOfMonth, getMonth, getYear
151:	mDatePicker.clearFocus(); 
152:	mCallBack.onDateSet(mDatePicker, mDatePicker.getYear(), 
153:	mDatePicker.getMonth(), mDatePicker.getDayOfMonth()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear
116:	t = new Time(datepicker.getYear(), datepicker.getMonth(), datepicker.getDayOfMonth(), timepicker.getCurrentHour(), timepicker.getCurrentMinute()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear
68:	return getDate(datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: clearFocus, getDayOfMonth, getMonth, getYear
240:	datePicker.clearFocus(); 
241:	onDateChanged(datePicker, datePicker.getYear(), datePicker.getMonth(), 
242:	datePicker.getDayOfMonth()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear
97:	this.when = datePlan.getYear() + "-" + datePlan.getMonth() + "-" + datePlan.getDayOfMonth() + " " + timePlan.getCurrentHour() + ":" + timePlan.getCurrentMinute() + ":00 PDT"; 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: clearFocus, getDayOfMonth, getMonth, getYear
66:	datePicker.clearFocus(); 
67:	onDateChanged(datePicker, datePicker.getYear(), datePicker.getMonth(), 
68:	datePicker.getDayOfMonth()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear
69:	c.set(Calendar.YEAR, this.date.getYear()); 
70:	c.set(Calendar.MONTH, this.date.getMonth()); 
71:	c.set(Calendar.DAY_OF_MONTH, this.date.getDayOfMonth()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: clearFocus, getDayOfMonth, getMonth, getYear
54:	mDatePicker.clearFocus(); 
-
56:	new Date(mDatePicker.getYear() - YEARSHIFT, mDatePicker.getMonth(), mDatePicker 
57:	.getDayOfMonth()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear
69:	c.set(Calendar.YEAR, this.date.getYear()); 
70:	c.set(Calendar.MONTH, this.date.getMonth()); 
71:	c.set(Calendar.DAY_OF_MONTH, this.date.getDayOfMonth()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear
31:	String date = new Date(datePicker.getYear() - 1900, 
32:	datePicker.getMonth(), 
33:	datePicker.getDayOfMonth(), 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: clearFocus, getDayOfMonth, getMonth, getYear
124:	mDatePickerFrom.clearFocus(); 
-
126:	fromCalendar.set(Calendar.YEAR, mDatePickerFrom.getYear()); 
127:	fromCalendar.set(Calendar.MONTH, mDatePickerFrom.getMonth()); 
128:	fromCalendar.set(Calendar.DAY_OF_MONTH, mDatePickerFrom.getDayOfMonth()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDayOfMonth, getMonth, getYear
46:	date = dpTime.getYear()+ "-" + (dpTime.getMonth()+1) + "-"+ dpTime.getDayOfMonth(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: clearFocus, getDayOfMonth, getMonth, getYear
134:	dateP.clearFocus(); 
-
143:	datetime.set(dateP.getYear(), dateP.getMonth(), dateP.getDayOfMonth(), timeP.getCurrentHour(), timeP.getCurrentMinute(), 0); 
Full Snippet Info
6
CodeRank
Related Android DatePicker Questions & Answers:
Other Android DatePicker Examples
14:	    }
15:	
16:	    public void onDateSet(DatePicker view, int year, int month, int day) {
17:	        // Do something with the date chosen by the user
18:	    }

Read More

See Code Examples for Android DatePicker Methods: