我試著在星期一的時候設置一個鬧鈴,但是沒起作用,如何在周一設置一個鬧鈴,並且只響一次呢?
if (chk_wednesday.isChecked()) {
weekday = 7 - calNow.get(Calendar.DAY_OF_WEEK);
calSet.add(Calendar.DATE, weekday);
forday(weekday);
}
public void forday(int week) {
days = calNow.get(Calendar.DAY_OF_MONTH);
month = calNow.get(Calendar.MONTH);
year = calNow.get(Calendar.YEAR);
calSet.set(Calendar.DAY_OF_WEEK, week);
calSet.set(Calendar.HOUR_OF_DAY, hour);
calSet.set(Calendar.MINUTE, minuts);
calSet.set(Calendar.SECOND, 0);
calSet.set(Calendar.MILLISECOND, 0);
calSet.set(Calendar.DAY_OF_MONTH, days);
calSet.set(Calendar.MONTH, month);
calSet.set(Calendar.YEAR, year);
if (calSet.compareTo(calNow) <= 0) {
// Today Set time passed, count to tomorrow
calSet.add(Calendar.DATE, 1);
}
Log.i("time1", "" + calSet.getTimeInMillis());
alarmManager.set(AlarmManager.RTC_WAKEUP, calSet.getTimeInMillis(),
pendingIntent);
}
第二的的提示音要打開日歷,菜單,設置,把提示音改掉就行