直接在Sqlite里用字节流存放图片,结果发现在获取字节流的过程总是会出错,
Caused by: java.lang.IllegalStateException: Couldn't read row 0, col 1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. at android.database.CursorWindow.nativeGetBlob(Native Method) at android.database.CursorWindow.getBlob(CursorWindow.java:403) at android.database.AbstractWindowedCursor.getBlob(AbstractWindowedCursor.java:45) at com.example.jialuzhang.picturesqlite.MainActivity.onCreate(MainActivity.java:84) at android.app.Activity.performCreate(Activity.java:6910) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2746) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2864) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:156) at android.app.ActivityThread.main(ActivityThread.java:6524) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)
原来是图片过大,听说当图片超过3M时就会发生这种情况,应该是跟sqlite数据类型的限制有关的吧