Code example for DatePickerDialog

Methods: setMessage

0
    	showDialog(DIALOG_DATE_ID);
    } 
    protected Dialog onCreateDialog(int id){
    	switch(id){
    	case DIALOG_DATE_ID:
    		DatePickerDialog dateDlg = new DatePickerDialog(this, 
    		         new DatePickerDialog.OnDateSetListener() {
    		           
    		         public void onDateSet(DatePicker view, int year,
    		                                             int monthOfYear, int dayOfMonth) 
    		         { 
    		                    Time chosenDate = new Time();        
    		                    chosenDate.set(dayOfMonth, monthOfYear, year);
    		                    long dtDob = chosenDate.toMillis(true);
    		                    CharSequence strDate = DateFormat.format("yyyy-MM-dd", dtDob);
    		                    stringDate = strDate.toString();
    		                    Toast.makeText(Freefood_DBActivity.this, 
    		                         "Date picked: " + strDate, Toast.LENGTH_SHORT).show();
    		        }}, 2011,0, 1); 
    		//dateMessage = stringDate; 
    		              
    		      dateDlg.setMessage("Choose Date");
    		      return dateDlg;
    	} 
    	return null;