0

i have a database file "myDB.db" (it have only one Table), and i put that file to assets folder, my app copy the data from it, i can read data there is no problem, but when i try to add a new ROW in my Table the new row only existing in data folder that mean if i clear data or reinstall my app i lose my new ROW. how to add that ROW to my file in assets folder "myDB.db"? or how to replace the new database from my data/data folder to my old file "myDB.db" in assets folder? i use this code

sorry for my bad ENGLISH.

Community
  • 1
  • 1
rida1148
  • 3
  • 3

1 Answers1

1

You cannot do that in the app. Assets are read-only.

You can modify the database on your computer and replace the source version of the asset that gets bundled in the APK.

For versioning preinstalled databases and without the problems with the code you're using, consider sqlite-asset-helper.

laalto
  • 150,114
  • 66
  • 286
  • 303