Android Question KeyValueStore library error

hanyelmehy

Active Member
Licensed User
Longtime User
i use : https://www.b4x.com/android/forum/threads/b4x-kvs2-keyvaluestore2-library.120234/
B4X:
    Public kvs As KeyValueStore
    kvs.Initialize(File.DirInternal, "savedw.dat")

when try to put or delete data i get this error
B4X:
Error occurred on line: 162 (KeyValueStore)
android.database.sqlite.SQLiteReadOnlyDatabaseException: attempt to write a readonly database (code 1032 SQLITE_READONLY_DBMOVED)
    at android.database.sqlite.SQLiteConnection.nativeExecuteForChangedRowCount(Native Method)
    at android.database.sqlite.SQLiteConnection.executeForChangedRowCount(SQLiteConnection.java:831)
    at android.database.sqlite.SQLiteSession.executeForChangedRowCount(SQLiteSession.java:756)
    at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:66)
    at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1806)
    at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1733)
    at anywheresoftware.b4a.sql.SQL.ExecNonQuery(SQL.java:74)
    at students.edraak.onlineexam.keyvaluestore._deleteall(keyvaluestore.java:97)
    at students.edraak.onlineexam.addstudent._deletealldata(addstudent.java:748)
    at students.edraak.onlineexam.addstudent._activity_create(addstudent.java:642)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at students.edraak.onlineexam.addstudent.afterFirstLayout(addstudent.java:105)
    at students.edraak.onlineexam.addstudent.access$000(addstudent.java:17)
    at students.edraak.onlineexam.addstudent$WaitForLayout.run(addstudent.java:83)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7410)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
 

mangojack

Well-Known Member
Licensed User
Longtime User
You cannot use DirInternal as it is read only.

DirAssets maybe ? ... I am sure DirInternal is fine.

 
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
I get no inForum results searching for that error ... but quite a few with an external / google search.

Somehow connected to Database or journal being removed / deleted / refreshed... Maybe a small sleep(200) before writing ??

Hopefully someone with more expertise in this area can help.
 
Upvote 0
Top