0

I have a database created in SQLiteManager from Mozilla, I exported it and saved the .sql file in assets folder, now how do I read or make entries in this database from my android app? How should my DatabaseHandler( which extends SQLiteOpenHelper) should look like?

Ayush Goyal
  • 2,079
  • 8
  • 32
  • 47

1 Answers1

0

You can't access it directly from the assets/. You need to copy it to a file (internal or external storage) the app can access directly. Then open as usual.

More details here: http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/

Nikolay Elenkov
  • 52,576
  • 10
  • 84
  • 84
  • I read somewhere that it needs to be placed in assets, where should I keep it? Please elaborate your answer, I'm new with database. – Ayush Goyal Aug 06 '12 at 03:28
  • You need to put it in assets in order to include it in the package APK. To use it at runtime, you need to copy it to a file (which assets isn't). See article link above. – Nikolay Elenkov Aug 06 '12 at 03:38
  • @AyushGoyal: The same issue is answered here:http://stackoverflow.com/questions/9109438/how-to-use-existing-database-with-android-app/9109728#9109728 – Yaqub Ahmad Aug 06 '12 at 04:50