0
我使用複選框多天的選擇如何通過使用多天的選擇,從我的應用程序
if (monday == 1) {
chkMonday.setChecked(true);
} if (tuesday == 1) {
chkTuesday.setChecked(true);
} if (wednesday == 1) {
chkWedneday.setChecked(true);
} if (thursday == 1) {
chkThursday.setChecked(true);
} if (friday == 1) {
chkFriday.setChecked(true);
} if (saturday == 1) {
chkSaturday.setChecked(true);
} if (sunday == 1) {
chkSunday.setChecked(true);
}
現在我想通過多次重複天,根據我從選擇天的日曆重複事件週報複選框。對於我,如果情況是這樣
values.put(CalendarContract.Reminders.TITLE, "Routine Custom");
values.put(CalendarContract.Reminders.DTSTART, millisecondsTimesEveryday);
values.put(CalendarContract.Reminders.HAS_ALARM, true);
if (chkMonday.isChecked()) {
values.put(CalendarContract.Reminders.RRULE, "FREQ=WEEKLY;COUNT=1;BYDAY=MO");//UNTIL=1924885800000
}else if (chkTuesday.isChecked()) {
values.put(CalendarContract.Reminders.RRULE, "FREQ=WEEKLY;COUNT=1;BYDAY=TU");
} else if (chkWedneday.isChecked()) {
values.put(CalendarContract.Reminders.RRULE, "FREQ=WEEKLY;COUNT=1;BYDAY=WE");
} else if (chkThursday.isChecked()) {
values.put(CalendarContract.Reminders.RRULE, "FREQ=WEEKLY;COUNT=1;BYDAY=TH");
} else if (chkFriday.isChecked()) {
values.put(CalendarContract.Reminders.RRULE, "FREQ=WEEKLY;COUNT=1;BYDAY=FR");
} else if (chkSaturday.isChecked()) {
values.put(CalendarContract.Reminders.RRULE, "FREQ=WEEKLY;COUNT=1;BYDAY=SA");
} else if (chkSunday.isChecked()) {
values.put(CalendarContract.Reminders.RRULE, "FREQ=WEEKLY;COUNT=1;BYDAY=SU");
}
values.put(CalendarContract.Reminders.DTEND, EndtimeInMilliseconds);
但在日曆,只有第一個選擇天重複使用的if..else。如何將所有選定日期設置爲提醒中的重複日期?
我想這會對你有所幫助。 https://stackoverflow.com/questions/44204387/alarmmanager-setinexactrepeating-setwindow-setrepeating-methods-do-not-fire-al/44205413#44205413 –
我希望它使用CalendarContract系統的日曆提醒。 @AniruddhParihar –
你可以再次清楚地解釋你的要求.. !! –