For some weird reason, when i click on the positive button as part of the DatePickerDialog, the onDateSet method as part of the DateSetListener does not get invoked ONLY ON SAMSUNG DEVICES.
Here is what i am doing :
DateSetListener _datePickerDialogCallback = new DateSetListener();
DatePickerDialog _datePickerDialog = new DatePickerDialog(context, _datePickerDialogCallback, year, month, days);
_datePickerDialog.setButton(DialogInterface.BUTTON_POSITIVE, StringUtil.getString(R.string.command_ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
_done = true;
}
});
_datePickerDialog.show();
private class DateSetListener implements DatePickerDialog.OnDateSetListener {
public void onDateSet(DatePicker view, int year, int month, int day) {
Calendar calendar = Calendar.getInstance();
calendar.set(year, month, day, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE),
calendar.get(Calendar.SECOND));
if (_done) {
_view.setText(formatDate(calendar.getTime()));
}
}
}
Any suggestions on why this might be happening would be appreciated. pls. note this is only on SAMSUNG DEVICES
It looks like from ICS and above, the callback need not be defined while defining the datePickerDialog. But, the onPositiveButtonClick and onNegativeButtonClick would have to call the callback. something like :
_datePickerDialog.setButton(DialogInterface.BUTTON_POSITIVE, "Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
_done = true;
DatePicker datePicker = _datePickerDialog.getDatePicker();
_datePickerDialogCallback.onDateSet(datePicker, datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth());
}
});