mercredi 27 janvier 2016

android SQLiteAssetHelper database query cursor exception

I want to move filled sqlite database with my apk. For that I have created database file from sqlite browser version 3.3.1 and put in assets folder.

For move database to package database I am using SQLiteAssetHelper. Database is correctly moved to package location as I checked with Android Device Monitor.

But when I am querying the database its giving me cursor exception as shown below:

01-28 12:40:13.437 733-733/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.dsml.ehaat, PID: 733 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dsml.ehaat/com.dsml.ehaat.MainActivity}: java.lang.IllegalStateException: Couldn't read row 1, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) at android.app.ActivityThread.access$800(ActivityThread.java:144) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

Finding: : But when I tried to move the created database using queries in created database function of SQLiteOpenHelper (Pull out from android device motior and again put in assets). Queries working fine.

Please help me to resolve it.

Aucun commentaire:

Enregistrer un commentaire