阅读Android 4.0+重复发生的事件

时间:2012-10-03 08:52:26

标签: android calendar icalendar rfc2445

我尝试在ICS上读取重复事件,周期性事件的startTime正常,但endTime为0(毫秒)。但就重复发生的事件而言,持续时间不是“空”。 我在测试事件中读到了“ P9000S ”的持续时间。它采用RFC2445格式,因此它不是单个事件的持续时间,而是从第一个事件到最后一个事件的持续时间。 RRULE给出了以下内容:FREQ = MONTHLY; COUNT = 3; BYMONTHDAY = 3。如何获得单个事件的结束时间?非常感谢提前! 这是我的预测:

                final String[] projection = new String[]
                { CalendarContract.Events.TITLE, CalendarContract.Events.DTSTART, CalendarContract.Events.DTEND, CalendarContract.Events.RRULE, CalendarContract.Events.ALL_DAY, CalendarContract.Events.DURATION};

修改

                final String[] projection = new String[]
                { CalendarContract.Events.TITLE, CalendarContract.Events.DTSTART, CalendarContract.Events.DTEND, CalendarContract.Events.DURATION, CalendarContract.Events.ALL_DAY, CalendarContract.Events.RRULE};

                // Construct the query with the desired date range.
                Uri.Builder builder = Instances.CONTENT_URI.buildUpon();
                ContentUris.appendId(builder, now - DateUtils.DAY_IN_MILLIS);
                ContentUris.appendId(builder, now + DateUtils.DAY_IN_MILLIS);

                eventCursor =   getContentResolver().query(
                        builder.build(), projection, Instances.CALENDAR_ID  + " = ?",
                        new String[]{""+calendarID}, CalendarContract.Events.DTEND +" ASC");

0 个答案:

没有答案
相关问题