我需要检查当前是否有“忙”的日历事件。
String[] projection = new String[] { BaseColumns._ID};
String selection = CalendarContract.Events.DTSTART + " <= ? AND "
+ CalendarContract.Events.DTEND + ">= ? AND "
+ CalendarContract.Events.AVAILABILITY + "=="
+ CalendarContract.Events.AVAILABILITY_BUSY;
Cursor cur = ctx.getContentResolver().query(CalendarContract.Events.CONTENT_URI,
projection,
selection,
new String[] {String.valueOf(System.currentTimeMillis()),
String.valueOf(System.currentTimeMillis())},
null);
这段代码工作正常,但不适用于重复发生的事件。 我该如何解决这个问题?
最佳答案
我认为您需要做的就是切换您从中读取的表格,see here .
CalendarContract.Instances
应提供所有事件,包括重复事件
This table holds the start and end time for each occurrence of an event. Each row in this table represents a single event occurrence. For one-time events there is a 1:1 mapping of instances to events. For recurring events, multiple rows are automatically generated that correspond to multiple occurrences of that event.
关于android - 检查日历事件是否正在进行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48356470/