Code example for DatePickerDialog

Methods: setOnDismissListener, show

0
        
        Bundle data = ThisActivity.getIntent().getExtras();
        long thedate = data.getLong("timeinmills");
        calSelected.setTimeInMillis(thedate);
         
        DatePickerDialog dater = new DatePickerDialog(this, Dlisten, calSelected.get(Calendar.YEAR),
                calSelected.get(Calendar.MONTH), calSelected.get(Calendar.DAY_OF_MONTH));
        dater.setOnDismissListener(DismissListener);
        dater.show();
    } 
     
    //Setting the date change listener which will update the values 
    public static DatePickerDialog.OnDateSetListener Dlisten = new DatePickerDialog.OnDateSetListener() {
        public void onDateSet(DatePicker dater, int year, int monthOfYear, int dayOfMonth) { 
            calSelected.set(Calendar.YEAR, year); 
            calSelected.set(Calendar.MONTH, monthOfYear); 
            calSelected.set(Calendar.DAY_OF_MONTH, dayOfMonth); 
             
            Bundle data = ThisActivity.getIntent().getExtras();  
            data.putLong("timeinmills", calSelected.getTimeInMillis()); 
            Intent intentData = ThisActivity.getIntent();