0

Is it possible to load table creation scripts from flat files when creating the SQLite database in Android?

I am going to have multiple tables and all the examples I have seen online using the SQLite helper classes, include the script text in the Java file and I'd rather not clutter up my class.

Swati Garg
  • 995
  • 1
  • 10
  • 21
Mr. Will
  • 2,298
  • 3
  • 21
  • 27
  • You can also use a pre-populated database, keep it in assests folder like explained here,http://stackoverflow.com/a/9109728/265167 – Yaqub Ahmad Feb 29 '12 at 05:33

1 Answers1

2

Yes. The same as with copying file from assets (https://gist.github.com/1271795) you can read file and execute commands on newly created SQLiteDatabase.

skyman
  • 2,422
  • 17
  • 16