0
報警我想創建一個在DatePicker的設置時間和TimePicker通知報警創建一個從的DatePicker和TimePicker
我的代碼是:
//Create alarm
GregorianCalendar tmpDate=new GregorianCalendar(datePicker.getYear(),datePicker.getMonth(),datePicker.getDayOfMonth());
long date=tmpDate.getTimeInMillis();
long hour=timePicker.getDrawingTime();
long dateTime=date+hour;
calendar=new GregorianCalendar();
if(dateTime<calendar.getTimeInMillis()){
Toast.makeText(getApplicationContext(),"No puedes crear la alarma antes de hoy", Toast.LENGTH_SHORT);
return;
}
AlarmManager alm=(AlarmManager)getSystemService(ALARM_SERVICE);
alm.set(AlarmManager.RTC_WAKEUP, dateTime,mAlarmSender);
如果我試着加5秒的當前時間有效,但設置時間日期和時間選擇器不會通知。