为什么Android中的重复事件的持续时间为NULL? [英] Why duration is NULL for recurrent event in android?
问题描述
我尝试实现与android日历事件的一种同步方式(我需要原始事件-而不是事件实例).因此,我有以下查询:
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);
根据开发人员文档中的周期性事件dtstart
和duration
是必需的,但是当我通过Google日历创建活动并稍后在我的代码中接收到它时,我有dtend = 0
和duration = null
.
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);
为什么会发生?
推荐答案
我的原始应用程序中的索引有问题. CalendarContract.Events.DURATION
列解决了该问题.它具有RFC2445
格式的单个事件持续时间.我只需要解析它.
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.
这篇关于为什么Android中的重复事件的持续时间为NULL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!