I’m programming some custom dialogs and I’ve run into some trouble with the showDialog method. For some reason, when I pass the id of the Dialog I want to create to the showDialog method, it executes both the intended case and the default case.
protected Dialog onCreateDialog(int id) {
switch (id) {
case DATE_DIALOG_ID:
Calendar c = Calendar.getInstance();
mYear = c.get(c.YEAR);
mMonth = c.get(c.MONTH);
mDay = c.get(c.DAY_OF_MONTH);
return new DatePickerDialog(this,
mDateSetListener,
mYear, mMonth, mDay);
default:
return null;
}
}
updated your code with following code,