please try this code. is successfully run in my apps
if (chk_monday.isChecked()) {
forday(2);
} else if (chk_tuesday.isChecked()) {
forday(3);
} else if (chk_wednesday.isChecked()) {
forday(4);
} else if (chk_thursday.isChecked()) {
forday(5);
} else if (chk_friday.isChecked()) {
forday(6);
} else if (chk_sat.isChecked()) {
forday(7);
} else if (chk_sunday.isChecked()) {
forday(1);
}
public void forday(int week) {
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);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
calSet.getTimeInMillis(), 1 * 60 * 60 * 1000, pendingIntent);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…