首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

关于Cursor的遇见的异常描述

2012-06-28 
关于Cursor的遇见的错误描述【解决】android.database.CursorIndexOutOfBoundsException:Index -1 requested

关于Cursor的遇见的错误描述

【解决】android.database.CursorIndexOutOfBoundsException:Index -1 requested, with a size of 0 ?

?

android 中数据库处理,特别是使用cursor时,注意初始位置,好像是从下标为-1的地方开始的,也就是说一次查询中,返回给cursor查询结果时,不能够马上从cursor中提取值。

?

比如,下面的代码会返回错误,android.database.CursorIndexOutOfBoundsException:Index -1 requested, with a size of 0:

?

?

();

?

[解决] ?Caused by: java.lang.IllegalStateException: get field slot from row 0 col -1 failed

?

?

原因有可能如下:

1,检查查询的字段名是否写错

2,?? 检查游标是否查询出你所需要的字段

?

热点排行