vendredi 11 mars 2016

Android SQLite Database with Inserted row

I am trying to make an application that comes with some pre inserted rows in the database for the user to use. I have looked at lots of different questions here relating to the same topic but I am still slightly confused.

At the moment I have a DB class that contains all the table creates and functions that interact with the different tables. From my understanding of reading around the best way to have pre populated data is creating a file in the assets folder and calling that to insert the data.

My question is, how do I format the assets file to carry out the inserts? Is it as simple as insert into table1 values (1,2,3,"test");? And should I be creating the tables in this file as well or can I create the tables in the main DB class and just call the assets file for the inserts?

Aucun commentaire:

Enregistrer un commentaire