Reputation: 3162
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:
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.
Upvotes: 1
Views: 3000
Reputation: 13873
Use InsertHelper to do a bulk insert. Take a look on this other question
Upvotes: 3
Reputation: 12367
It really does not matter - you can achieve good perfomance with both approaches. With XML you can use some databinding, making programming easier (marginally). You may also consider JSON as transport format.
When parsing, keep in mind that building complete object tree in memory ( like XML DOM parser) consumes a lot of memory and results in a lot of allocations - pull parsing model like XPP / GSON is preferable.
Upvotes: 3
Reputation: 11256
Instead of XML or CSV files, you can directly use an external sqlite DB you prepared in your computer. This technique is explained here: http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
Upvotes: 3