Search code examples
androidsqlitelarge-data

Load large amount of data to DB - Android


I'm building a new application to the Android platform and I need a suggestion. I have a large amount of data that I want to import into a sqlite DB, something like 2000 rows. My question is what is the best method to load the data into the DB?

Two ways I think of:

  1. An xml file that holds all the data and then loads it with DocumentBuilder object.
  2. A CSV file, and loads it with String Tokenizer. Found that post.

I want it to be with external file because When I release an update I will replace only the that file.

I want something that would be efficient as much as possible - all the data will load at the first startup of the application and I need it to be fast.

Any suggestion would be great. Thanks.


Solution

  • Use InsertHelper to do a bulk insert. Take a look on this other question