I have a database that I built in SQLite browser, and it works fine. I launched an app with a prebuilt database and now I want to add more tables and data to that database.
I can get the app to launch the onUpgrade()
method of the SQLiteOpenHelper
. But the problem is, it's doing that EVERY time I use the helper.
I have it localized to, only on app launch, separating the upgrade command from the helper I used to retrieve data, but this is still a problem.
I have figured it out though, as I have been using the same database on my computer (the one that I'm editing) since version 1. So, whenever it writes the newer database onto the SD card it's showing version 1 even though I should be up to version 4 by now.
So, my question is, how can I manually edit the database version of the original database so that when it updates it isn't writing the old version number over the new one?
If you have a data connection to it in Visual Studio, you can right click on the data base in Server Explorer, select properties, and the version will be shown in the properties window, (under Version, surprisingly). You might need to left click the database first to open it.
1 Answer. Show activity on this post. In which case, does that mean that SQLLite is deprecated in Android? No.
The Android SDK and Android emulators both include the sqlite3 command-line database tool. On your development machine, run the tool from the platform-tools/ folder of your SDK. On the emulator, run the tool with adb shell, for example, adb -e shell sqlite3 .
To manually update the version to 4 you execute the following SQL statement:
PRAGMA user_version = 4
Another way to change the version of your Sqlite Database. You can use DB Browser for SQLite:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With