Why duration is NULL for recurrent event in android?

倾然丶 夕夏残阳落幕 提交于 2019-12-02 05:00:17

问题


I try to implement one way synchronization with android calendar events (I need original events - not event instances). So, I have the following query:

String[] projection = new String[]{
                    CalendarContract.Events.DTSTART,
                    CalendarContract.Events.EVENT_TIMEZONE,
                    CalendarContract.Events.DTEND,
                    CalendarContract.Events.EVENT_END_TIMEZONE,
                    CalendarContract.Events.DURATION
            };
String selection = null;
String[] args = new String[0];
String sort = CalendarContract.Events.DTSTART + " ASC";
Cursor cursor = getContentResolver().query(CalendarContract.Events.CONTENT_URI, projection, selection, args, sort);

According to developer docs for recurrent events dtstart and duration are required but when I create event through Google calendar and receive it later in my code I have dtend = 0 and duration = null.

Integer dtend = cursor.getLong(2);
String duration = cursor.getString(4);

Why it may happen?


回答1:


I have an issue with indexes in my original application. CalendarContract.Events.DURATION column solves the problem. It has single event duration in RFC2445 format. I just need to parse it.



来源:https://stackoverflow.com/questions/40221843/why-duration-is-null-for-recurrent-event-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!