将图像插入sqlite并将图像检索到活动

时间:2017-03-12 15:40:33

标签: android image-processing android-sqlite

运行上面的代码时,我遇到了这样的错误。请帮帮我..

E / AndroidRuntime:致命异常:主要                   处理:com.example.kalya.farmers1,PID:32178                   java.lang.RuntimeException:无法启动活动ComponentInfo {com.example.kalya.farmers1 / com.example.kalya.farmers1.Harvestitems}:android.database.sqlite.SQLiteException:无法将数据库从版本2降级为1                       在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2544)                       在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2618)                       在android.app.ActivityThread.access $ 800(ActivityThread.java:183)                       在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1475)                       在android.os.Handler.dispatchMessage(Handler.java:111)                       在android.os.Looper.loop(Looper.java:194)                       在android.app.ActivityThread.main(ActivityThread.java:5651)                       at java.lang.reflect.Method.invoke(Native Method)                       在java.lang.reflect.Method.invoke(Method.java:372)                       在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:959)                       在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)                    引起:android.database.sqlite.SQLiteException:无法将数据库从版本2降级为1                       在android.database.sqlite.SQLiteOpenHelper.onDowngrade(SQLiteOpenHelper.java:360)                       在android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:254)                       在android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)                       at com.example.kalya.farmers1.DataBaseHandler.getAllContacts(DataBaseHandler.java:97)                       在com.example.kalya.farmers1.Harvestitems.onCreate(Harvestitems.java:43)                       在android.app.Activity.performCreate(Activity.java:6119)                       在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112)                       在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2491)                       在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2618)                       在android.app.ActivityThread.access $ 800(ActivityThread.java:183)                       在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1475)                       在android.os.Handler.dispatchMessage(Handler.java:111)                       在android.os.Looper.loop(Looper.java:194)                       在android.app.ActivityThread.main(ActivityThread.java:5651)                       at java.lang.reflect.Method.invoke(Native Method)                       在java.lang.reflect.Method.invoke(Method.java:372)                       在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:959)                       在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754) I /处理:发送信号。 PID:32178 SIG:9 申请已终止。

1 个答案:

答案 0 :(得分:0)

android.database.sqlite.SQLiteException: Can't downgrade database from version 2 to 1似乎错误是您尝试将数据库版本从2更改为1.尝试将数据库版本重置为2或者如果您进行了一些修改,请尝试将版本设置为3 。 如果您也可以发布一些代码,也许会有所帮助。