Code example for DatePickerDialog

Methods: setButton, show

0
 
		} else if (ACTION_DATE.equalsIgnoreCase(action)) { 
			runnable = new Runnable() { 
				public void run() { 
					final DateSetListener dateSetListener = new DateSetListener(datePickerPlugin, callbackContext);
					final DatePickerDialog dateDialog = new DatePickerDialog(currentCtx, dateSetListener, mYear,
							mMonth, mDay); 
					//Additions 
					 dateDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() {
				            public void onClick(DialogInterface dateDialog, int which) {
				               if (which == DialogInterface.BUTTON_NEGATIVE) {                 
				                  dateDialog.dismiss();
				               } 
				            } 
				          }); 
					dateDialog.show();
				} 
			}; 
 
		} else { 
			Log.d(pluginName, "Unknown action. Only 'date' or 'time' are valid actions");