android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1
来源:互联网 发布:php与mysql权威指南 编辑:程序博客网 时间:2024/05/16 05:16
android开发中,通常会使用cursor去获取数据库中的数据,通过查询数据库,返回的的是一个cursor游标,这个游标初始的位置是第一个行记录的上方,index值为-1,这个时候若直接使用这个cursor去获取数据就会出现像标题的错误。解决的方法也很简单,只需移动游标就行
查询第一个行记录的数据 执行cursor.moveToFirst();
查询指定行的数据 执行cursor.moveToPosition(position);
通常使用最多的就是遍历整张表的记录 使用 while(cursor.moveToNext()){};
0 0
- Android开发7——android.database.CursorIndexOutOfBoundsException:Index -1 requested, with a size of 1
- android.database.CursorIndexOutOfBoundsException:Index -1 requested, with a size of 1
- android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1
- android.database.CursorIndexOutOfBoundsException:Index -1 requested, with a size of 1
- android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1
- android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1
- android.database.CursorIndexOutOfBoundsException:Index -1 requested, with a size of 1
- android.database.CursorIndexOutOfBoundsException:Index -1 requested, with a size of 1
- android.database.CursorIndexOutOfBoundsException:Index -1 requested, with a size of 0
- android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 3
- Caused by: android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 2
- qlite操作时出现下面错误 android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of
- android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 14
- android.database.CursorIndexOutOfBoundsException: Index <m> requested, with a size of <n>
- android.database.CursorIndexOutOfBoundsException: Index 5 requested, with a size of 5
- android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
- android.database.CursorIndexOutOfBoundsExcept: Index -1 requested, with a size of 1
- cursor使用错误(android.database.CursorIndexOutOfBoundsException: Index -1 requested)
- JSTL-核心标签库
- 解决session过期超时跳转到登陆页面并跳出iframe框架
- 过河卒
- 浏览器User-agent String里的历史故事
- how to get Class of primitive datatypes array . Class.forName(int[]) throws exception
- android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1
- js表单提交验证
- Android查看网络图片例子
- 跑酷游戏 之 状态机的理解
- Android: NDK编程入门笔记
- dwarf调试信息格式入门
- 让他红人馆豆腐干地方大法官
- hdu oj2050杭电acm2050 折线分割平面
- poj 2236 Wireless Network(并查集)