TimePickerDialog cancel button

前端 未结 6 1172
暗喜
暗喜 2021-01-06 07:30

I have an activity - TimePickerActivity - which creates a TimePickerDialog. I have a onTimeSetListener which responds to the Set button at the end of which it calls finish(

6条回答
  •  一生所求
    2021-01-06 07:55

    I've just override (kotlin sample code)

    override fun onCancel(dialog: DialogInterface?) {
       super.onCancel(dialog)
       callback?.onCancelClick()
    }
    

    method inside my DialogFragment and called onCancelClick of my interface:

    interface SetAlarmTimeListener: TimePickerDialog.OnTimeSetListener {
        fun onCancelClick()
    }
    

提交回复
热议问题