1

我对这段代码有一个奇怪的问题:

private static final String[] CALENDARS_PROPS_PROJECTION = { Calendars._ID, Calendars.NAME, Calendars.CALENDAR_DISPLAY_NAME, Calendars.CALENDAR_TIME_ZONE, Calendars.DELETED };

protected Uri getURI() {
     return CalendarContract.Calendars.CONTENT_URI
            .buildUpon().appendQueryParameter(android.provider.CalendarContract.CALLER_IS_SYNCADAPTER,   "true")
            .appendQueryParameter(Calendars.ACCOUNT_NAME, account.name)
            .appendQueryParameter(Calendars.ACCOUNT_TYPE, account.type)
            .build();
}

ContentResolver cr = ...
Cursor cur = cr.query(getURI(), CALENDARS_PROPS_PROJECTION, Calendars.DELETED + "=?", new String[] { "0" }, null);

这段代码工作了几个月,我能够枚举我设备上存在的所有日历,但突然它开始返回一个 getCount() 返回 0 的游标。

所有日历和事件都可以像以前一样通过 S Planner 应用程序看到。

有任何想法吗?

4

1 回答 1

0

The solution was simple: remove

.appendQueryParameter(Calendars.ACCOUNT_NAME, account.name)
.appendQueryParameter(Calendars.ACCOUNT_TYPE, account.type)
于 2013-11-04T09:59:49.427 回答