-1

I have a text file that contains around 2000 words, I'm working on an Android application that will display 2-7 words each time ( in the same order of words stored in that file).

It's obvious that its not efficient to load the file and get the words to be displayed every time the application starts.

I thought about storing the words in a database and retrieve the words that I need to display. I have never dealt with database before. But I know that I should create the database once and access it in next runs.

Is this possible?

Or should I write another application to create the database and then access it in android?

Regards,

Alaa
  • 539
  • 3
  • 8
  • 29

1 Answers1

0

At the first run of your application create the database by reading the file content. Show a progress window to the user. Here is a nice tutorial using sqllite databse. Android SQLite database and content provider - Tutorial

Emil
  • 2,786
  • 20
  • 24
  • how can I know that this is the first run of my app?? – Alaa Jun 22 '15 at 08:35
  • The simplest method is using a shared preference. [Detect First Run](http://stackoverflow.com/questions/7217578/check-if-application-is-on-its-first-run) – Emil Jun 22 '15 at 08:40
  • I see, would it better if I create the database and populate it with the data using Java app. and then access this database in android app?? – Alaa Jun 22 '15 at 08:41
  • 1
    Yeah. that'l work too.. Create the db and store it in asset. and extract in the first run. – Emil Jun 22 '15 at 08:50