Dien Nguyen
Dien Nguyen

Reputation: 2059

Android dictionary app design

I am trying to create an Android dictionary-like application and get slow performance on retrieving the data. Currently, each dictionary entry is stored in a text file (inside Android assets), each file is named as number, so that I can use index to locate, open and read the file's content (simply read out a single line of String). When using ListView to render the output data and reading the file's content inside getView() method, it takes about 3 second to retrieve 10 entries. I just wonder if there are another approaches (using SQLLite, ???) for retrieving and rendering these entries faster. Any recommendations are appreciated.

Upvotes: 1

Views: 561

Answers (2)

ajmal
ajmal

Reputation: 4252

I would suggest you to use SQLite

Advantages

  1. You can query
  2. You can update definitions easily
  3. Your data is more secure while using database (If you can Encrypt using AES or similar algorithm it, then it will become more secure!)
  4. Fetching results is more faster
  5. You can easily populate the results to a ListView

You can see a complete article here

Upvotes: 1

Oleg Vaskevich
Oleg Vaskevich

Reputation: 12672

SQLite will definitely make your job easier and make the app work faster. It's also a lot easier to read data; when you're writing data to the DB make sure to use transactions to speed up multiple sequential writes. I probably wouldn't even consider using a text file except for initial data. There are many resources available online such as this tutorial.

Upvotes: 1

Related Questions