Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DatePicker Example in android

Please suggest me some tutorial which gives the example for DatePicker and how to use its methods like OnDateChangedListener, onDateChanged etc. Actually I am going through some sites, but i did not get the clear idea of it.

Thank you

like image 238
Jomia Avatar asked Dec 01 '10 04:12

Jomia


People also ask

What is the use of date and picker explain it with example?

In Android, DatePicker is a widget used to select a date. It allows to select date by day, month and year in your custom UI (user interface). If we need to show this view as a dialog then we have to use a DatePickerDialog class. For selecting time Android also provides timepicker to select time.

What is the use of DatePicker?

Android DatePicker is a user interface control that is used to select the date by day, month, and year in the android application. DatePicker is used to ensure that the users will select a valid date.

How do I create a DatePicker?

If the Controls task pane is not visible, click More Controls on the Insert menu, or press ALT+I, C. Under Insert controls, click Date Picker. In the Date Picker Binding dialog box, select the field in which you want to store the date picker data, and then click OK.

What is meant by DatePicker?

Android DatePicker is a widget to select date. It allows you to select date by day, month and year. Like DatePicker, android also provides TimePicker to select time.


1 Answers

Android references on DatePicker is quite good. Have a look at it here.

private DatePicker datePicker;
//monthofYear is between 0-11
datePicker.init(2010, 11, 1, new OnDateChangedListener() {
@Override
public void onDateChanged(DatePicker view, int year, int monthOfYear,int dayOfMonth) {
    // Notify the user.

}
});
like image 149
Raunak Avatar answered Oct 16 '22 23:10

Raunak