Orest
Orest

Reputation: 1897

Creating SQLite DB in Android From Script

Is it possible to use some kind of ddl script in SQLiteHelper to create database?

Upvotes: 0

Views: 809

Answers (1)

Rich
Rich

Reputation: 36816

Yes. I usually have a main DB class in my application that encapsulates an inner class that derives from SQLiteOpenHelper. In the onCreate, you get a SQLiteDatabase instance as a parameter. Call db.execSQL(String) with the appropriate script(s) to create your tables and populate them.

Upvotes: 1

Related Questions