Frozen Crayon
Frozen Crayon

Reputation: 5400

How to store a large number of words (to be accessed by an android app)?

I have a list of words (112,000 in alphabetical order) with one word definitions. The definitions are sometimes more than one and are in the format:

word:definition1|definition2|...

The max number of definitions for a word is 8.

I need a method to store these in a file (or more is okay) so they can be accessed by an android app. Only one word will be accessed at a time. This list will never change.

Considering SQLite, how would I insert the large data into a database?

Considering RandomAccessFile, how would I create a index for these words?

Is there another way? Thanks.

Upvotes: 0

Views: 1119

Answers (2)

Tapan Thaker
Tapan Thaker

Reputation: 362

Use a sqlite DB , storing 112,000 or more shouldn't be a problem at all for sqlite . Your can use your db schema something like the following :

enter image description here

And there can be multiple entries of wordId -> meaningId , for each word .

for pre-storing data you could use a tutorial provided by me in my blog : Using Pre-populated sqlite database in android

Upvotes: -1

Paresh Mayani
Paresh Mayani

Reputation: 128428

I would suggest you to go with SQLite as it would be easy to fetch data as and when required and it would be simply easy to get/date/update data from particular position too.

One more benefit is that you can prepare SQLite database by using GUI tool too.

Now follow below procedure to use Existing SQLite database, means that you will have database ready with words data:

  1. Prepare SQLite database same as we do in .NET , here you can prepare it using one of the best tool SQLite Manager which you can download it as a tool/add-on inside Mozilla Firefox.

  2. Once you are done with database, simple paste it inside assets folder.

  3. Now write a code to copy database from assets folder into our app. There are plenty of examples available on web for the same.

Upvotes: 3

Related Questions