How to update a database used as a source of data by an Android app -


I have an app that uses large amounts of data that has been compiled outside the app (my On the main PC). The app is for my personal use so there are no difficulties in distributing data updates of other users. However, I want to update the data at present, whenever I am following a very complex and time consuming process, and I wonder if anyone can suggest ways to make it easier.

Whenever I want to add new data as follows:

  • I enter the data in a new CSV file which is the corresponding table in the database As a source,

  • I use the SQLite database browser to import data into an existing SQLite database (in this program to attach the imported data to the current table Does not have the ability, so whenever a table updates , Then I have to delete the existing table, then import the data from the CSV file into a new table, then manually edit the data type for all the fields in the table.)

  • I drag the icon to the database file on my project 'Assets folder' in Excel

  • I export from eclipse as an APK file.

  • I copy the APK file to my phone

  • (using the Astro File Manager) I have an older version of the app Uninstall and install new APK.

  • When the app is run, the code sets up the copies in the data folder of the data app from the 'property' folder, depending on the instance; This means that each byte of data takes two bytes in the internal memory of the phone; This is not a problem at present, but it can be because the amount of data increases; I wonder if there is a more memory-efficient method?

I should be very grateful for any guidance.

I have found that I can have an SQLite database on the SD card, which has many things for me (And reduces the amount of internal storage by my app.)

The first clue for an app to refer to a database on the SD card was that it is possible ( Contrary to the impression received from Android documents and Android documentation). / P>

Then I found here on the Stack Overflow which shows how easy the code can be.

With the help of advice on these pages, now my app has a very simple DBEHELLER code where the OpenDataBase () method reads as follows:

Public Zero Access Database () SQLException throws {
file dbfile = new file (DB_PATH + DB_NAME); MyDataBase = SQLiteDatabase.openOrCreateDatabase (dbfile, null); }

Now there is no need to include the database in the "property" of my project, nor does it need to be included in the APK file. And the great advantage is that the database can be updated without having to go anywhere near Eclipse, reinstalling the application alone


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -