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.
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:
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.
Once you are done with database, simple paste it inside assets
folder.
Now write a code to copy database from assets
folder into our app. There are plenty of examples available on web for the same.
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 :
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.