Storing a dictionary

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Storing a dictionary

Postby PocariSweat1991 » Fri Nov 20, 2009 12:17 am

Hello!

My application needs to store about 5000 records of data that will never change. An example would be a dictionary of 5000 words.

Initially, I started creating a string-array.xml resource file for these records, but realized that I wanted to associate integer data with each string-array as well.

Therefore, I started looking into the SQLite database for storing these records. This seems like a great option, but I discovered that the database will be created the first time the application runs. This means that the first time a users downloads my application, they will have to wait a *very* long time for the database to build ... which is a horrible user experience.

Are there any other options for defining and storing application data that will never change? Ideally, I would like this dictionary to be shipped with the application, rather than created after installation.

Thank you.
PocariSweat1991
Freshman
Freshman
 
Posts: 3
Joined: Thu Nov 19, 2009 12:26 am

Top

Postby PocariSweat1991 » Fri Nov 20, 2009 3:34 am

For those interested, I have found an interesting solution in the following blog post:

http://www.reigndesign.com/blog/using-y ... lications/

This solution performs a byte-stream transfer of a database in the assets folder, to a new database on the system. I have not tested this yet, but I think it will be faster than INSERT-ing multiple records.
PocariSweat1991
Freshman
Freshman
 
Posts: 3
Joined: Thu Nov 19, 2009 12:26 am

Postby Emmanuel7 » Fri Nov 20, 2009 8:47 pm

I did the same thing : embedding (~300 000 words if I recall correctly ) a dictionary in my game.
And my first try was storing the database in my application, and restore it at launch.

I explained it here :
http://androidblogger.blogspot.com/2009/05/how-to-ship-application-with-pre-baked.html

There is quite no time to install, it's fast to make requests...

I finally change to a in house method because of the place it took in my apk, but for 'just' 5000 records, it should not be as important...

Hope it helps
Emmanuel7
Senior Developer
Senior Developer
 
Posts: 164
Joined: Fri Dec 12, 2008 2:17 am
Location: Paris

Postby PocariSweat1991 » Fri Nov 20, 2009 11:54 pm

Emmanuel,

I've read your blog post and was interested to learn that the size of your .apk was 7Mb!

I will explore the option of storing the dictionary in a compact-tree, or downloading the database from a web-source.

Merce pour votre réponse.
PocariSweat1991
Freshman
Freshman
 
Posts: 3
Joined: Thu Nov 19, 2009 12:26 am

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 5 guests