WearableCalendarContract查询"不支持排序顺序"错误

时间:2016-06-07 02:21:27

标签: android wear-os calendarcontract

尝试将排序顺序应用于查询时,我收到Sort order is not supported错误。如果排序顺序为null,则查询运行正常。有人能帮我一下吗?代码如下:

            long currentTime = System.currentTimeMillis();
            Uri.Builder builder = WearableCalendarContract.Instances.CONTENT_URI.buildUpon();
            ContentUris.appendId(builder, currentTime);
            ContentUris.appendId(builder, currentTime + DateUtils.DAY_IN_MILLIS);

            final String[] PROJECTION = {
                    CalendarContract.Calendars._ID, // 0
                    CalendarContract.Instances.BEGIN, // 1
                    CalendarContract.Instances.END, // 2
                    CalendarContract.Events.DISPLAY_COLOR, // 3
                    CalendarContract.Events.TITLE, // 4
                    CalendarContract.Events.ALL_DAY // 5
            };

            final Cursor cursor = getContentResolver()
                    .query(builder.build(),
                            PROJECTION,
                            null, // selection (all)
                            null, // selection args
                            CalendarContract.Instances.BEGIN + " ASC"); // order

1 个答案:

答案 0 :(得分:1)

正如错误消息所述,WearableCalendarContract.Instances.CONTENT_URI不支持排序。它是CalendarContract的完全独立的实现,即使它共享相同的字段。