0

I have quite large SQLite database (around 80.000 lines), and i whant to use it in my application. So the question is: how to implement this? I found solution:

  • adding file.db into project/assets folder
  • write my own SQLiteOpenHelper

is enought for that purpose? will it work fine with such large ammount of records?

user2843366
  • 85
  • 1
  • 1
  • 3
  • [This answer][1] might be useful in work with assets database. [1]: http://stackoverflow.com/questions/9109438/how-to-use-an-existing-database-with-an-android-application – yurezcv Nov 12 '13 at 14:41

1 Answers1

1

Use SQLiteAssetHelper. There are instructions for packaging the database (ZIP file inside of assets/). Then you extend SQLiteAssetHelper instead of SQLiteOpenHelper. It will handle unpacking the database for you.

The number of database "lines" does not matter. However, bear in mind that an APK cannot be over 50MB without running into problems (e.g., cannot distribute via the Play Store).

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491