سؤال

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.

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top