我正在从 Android 日历中读取一些数据,有时我会收到来自用户的奇怪崩溃报告,例如:
java.lang.IllegalStateException: Couldn't read row 384, col 47 from CursorWindow.
Make sure the Cursor is initialized correctly before accessing data from it.
我的代码在这里(粗体是应用程序崩溃的行):
Cursor eventCursor = contentResolver.query
(builder.build(),
null,
CalendarContract.Instances.CALENDAR_ID + " IN (" + ids + ")",
null,
null);
if (eventCursor == null)
return true;
while (eventCursor.moveToNext()) { //this line causecrash
... do something...
}
为什么会发生这种情况?无法模拟。它从来没有发生在我身上,我无法理解原因和错误信息。