WearableCalendarContract 查询 "Sort order is not supported" 错误
WearableCalendarContract query "Sort order is not supported" error
我在尝试对我的查询应用排序顺序时收到 Sort order is not supported
错误。如果排序顺序为空,查询运行得很好。有人能帮我一下吗?代码如下:
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
正如错误信息所说,WearableCalendarContract.Instances.CONTENT_URI
不支持排序。它是与 CalendarContract
完全独立的实现,即使它共享相同的字段。
我在尝试对我的查询应用排序顺序时收到 Sort order is not supported
错误。如果排序顺序为空,查询运行得很好。有人能帮我一下吗?代码如下:
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
正如错误信息所说,WearableCalendarContract.Instances.CONTENT_URI
不支持排序。它是与 CalendarContract
完全独立的实现,即使它共享相同的字段。