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
Examples using Android DatePicker getDayOfMonth method:
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
Examples using Android DatePicker getMonth method:
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
Examples using Android DatePicker getYear method:
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
Examples using Android DatePicker setMaxDate method:
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
Examples using Android DatePicker setEnabled method:
This code example shows how to use the following methods: setEnabled
363:	_datePicker.setEnabled(v); 
Full Snippet Info
6
CodeRank
Examples using Android DatePicker updateDate method:
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
Examples using Android DatePicker init method:
This code example shows how to use the following methods: init, setEnabled, setFocusable
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: 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
Examples for other Android DatePicker methods:
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

DatePicker Class Overview
This class is a widget for selecting a date. The date can be selected by a year, month, and day spinners or a CalendarView. The set of spinners and the calendar view are automatically synchronized. The client can customize whether only the spinners, or only the calendar view, or both to be displayed. Also the minimal and maximal date from which dates to be selected can be customized. See the Pickers gui...
Methods
  • init
    Initialize the state.
  • setMaxDate
    Sets the maximal date supported by this DatePicker in milliseconds since January 1, 1970 00:00:00 in getDefault() time zone.
  • setMinDate
    Sets the minimal date supported by this NumberPicker in milliseconds since January 1, 1970 00:00:00 in getDefault() time zone.