java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
IllegalState:非法状态。在调用cursor查询数据库是出现此错误。返回的值是-1,说明没找到这个字段。
首先查询:
if (cursor.moveToFirst()) {
do {
// your content
} while (cursor.moveToNext());
}
把上面的代码改为下面的:
while (cursor.moveToNext()) {
// your content
}
Like this.
如果还不行,就可能是数据库的问题。检查一下数据库。