本文介绍了WearableCalendarContract 查询“不支持排序顺序";错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在尝试将排序顺序应用于我的查询时收到 Sort order is not supported
错误.如果排序顺序为空,则查询运行得很好.有人能帮我一下吗?代码如下:
I'm getting a Sort order is not supported
error when trying to apply a sort order to my query. The query runs just fine if the sort order is null. Can anyone help me here? Code is below:
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
完全不同的实现,即使它共享相同的字段.
Exactly as the error message says, WearableCalendarContract.Instances.CONTENT_URI
does not support sorting. It is a completely separate implementation from CalendarContract
, even though it shares the same fields.
这篇关于WearableCalendarContract 查询“不支持排序顺序";错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!