I am having a weird issue where in the onClick() listener on TimePickerDialog has stopped working on Android 8.0.
Here is my code:
_timePickerDialog.setButton(DialogInterface.BUTTON_POSITIVE,"SET", new DialogInterface.OnClickListener() {
//System.out.println("ZZZZZ HIT!!!! onClick for _showTimeDialog ");
public void onClick(DialogInterface arg0, int arg1) {
_done = true;
/*
* HACK: TimePickerDialog does not have a public method to return
* the TimePicker hence we get a handle to the TimePicker from the
* sdk. This would not work if the id of that component changes.
*/
System.out.println("ZZZZZ HIT!!!! onClick for _showTimeDialog ");
int searchPlateId = _timePickerDialog.getContext().getResources().getIdentifier("android:id/timePicker", null, null);
TimePicker searchPlate = (TimePicker) _timePickerDialog.findViewById(searchPlateId);
//String android_os = getAndroidVersion(android.os.Build.VERSION.SDK_INT);
// if(android.os.Build.VERSION.SDK_INT > 23)
_timePickerDialogCallback.onTimeSet(searchPlate, searchPlate.getHour(), searchPlate.getMinute());
// else
// _timePickerDialogCallback.onTimeSet(searchPlate, searchPlate.getCurrentHour(), searchPlate.getCurrentMinute());
//_timePickerDialogCallback.onTimeSet(searchPlate, searchPlate.getHour(), searchPlate.getMinute());
//_timePickerDialogCallback.onTimeSet(searchPlate, searchPlate.getCurrentHour(), searchPlate.getCurrentMinute());
System.out.println("ZZZZZ END HIT!!!! onClick for _showTimeDialog ");
}
});
The same code works when i wire it with the DialogInterface.BUTTON_NEUTRAL or DialogInterface.BUTTON_NEGATIVE buttons.
This also works on older version of Android.
Issue I am observing is that click on OK button doesn't hit the onClick() method.
Please advise.