how to set time of timepicker to countdowntimer?

前端 未结 1 1188
眼角桃花
眼角桃花 2020-12-22 07:26

I am using timepicker to my app,now i am able to set time from timepicker and send it to next activity,now in next activity i am using countdown timer,now in my countdown ti

相关标签:
1条回答
  • 2020-12-22 08:15

    Here hour1 and min1 are default selected time of dialog..

    void setTimeInterval() {
            Calendar mcurrentTime = Calendar.getInstance();
            int hour1 = mcurrentTime.get(Calendar.HOUR_OF_DAY);
            int minute1 = mcurrentTime.get(Calendar.MINUTE);
            TimePickerDialog mTimePicker;
            mTimePicker = new TimePickerDialog(getActivity(), new TimePickerDialog.OnTimeSetListener() {
                @Override
                public void onTimeSet(TimePicker timePicker, int selectedHour, int selectedMinute) {
                    // eReminderTime.setText(selectedHour + ":" +
                    // selectedMinute);
                    hour = selectedHour;
                    minute = selectedMinute;
                    if (hour > 0 || minute > 0) {
                        sendSettingsTimeInterval();
                    }
                }
    
            }, hour1, minute1, true);// Yes 24 hour time
            mTimePicker.setTitle("Select Time Interval");
            mTimePicker.show();
        }
    
    0 讨论(0)
提交回复
热议问题