mardi 1 septembre 2015

Is it a good idea to fill a database using a .txt?

I am currently learning how to use database in Android. For one of my app, I need to stock 500 string values in order to read them. Actually to fill my database, I read a .txt file at the database creation with all the string values inside. For each lines of .txt (corresponding to a string value), I create a new data in the database. The thing is I know that accessing a file can be long it is not a very good thing if there are thousands of values. According to that, I have two questions :

  • Is it really usefull to create a database ? (because I can directly access the string values by reading the .txt)

  • Is there a better way to fill the database ? Or a way to create a database already filled before the activity creation ? (because currently, each time you close the activity you close the database and each time you reopen it, it recreate and refill the database.)

Aucun commentaire:

Enregistrer un commentaire