android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 14
来源:互联网 发布:飞毛腿跑腿软件好吗 编辑:程序博客网 时间:2024/05/17 08:13
当我只删除数据库中的一条数据时,报了一下错误:
02-09 11:03:43.970 6556-6556/com.aabao.adnroid E/AndroidRuntime: FATAL EXCEPTION: main
android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 14
at android.database.AbstractCursor.checkPosition(AbstractCursor.java:424)
at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136)
at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:50)
at com.aabao.adnroid.fragment.MPFragment.onClick(MPFragment.java:363)
at android.view.View.performClick(View.java:4204)
at android.view.View$PerformClick.run(View.java:17355)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
CursorIndexOutOfBoundsException: Index -1 requested, with a size of 14 意思是Cursor标记越界异常:index位-1,有14条数据
显然 index = -1是没有数据的,Cursor是从index = -1开始的,一般遍历数据库会用到Cursor.moveToNext() 方法,当有下一条数据的时候才会使用Cursor
知道了原理就好说了,得到一条数据时调用moveToNext()方法就可以啦
- android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 14
- 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 <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)
- 工作邮箱的几点浅见
- directx数学基础1
- ZKFC(Zookeeper Failover Controller)原理【详细版】
- jsp + servlet 通过a 标签下载文件
- bss,data,text,rodata,堆,栈,常量段
- android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 14
- Drawable 文件夹——xml文件
- 1060. Are They Equal (25)
- 3.scala容器
- 417. Pacific Atlantic Water Flow dfs
- Scala学习笔记 --- scala中 => 作用
- 共生矩阵纹理特征提取
- springmvc使用流程
- 混杂设备驱动模型设计LED驱动