LA_ LA_ - 2 years ago 59
Java Question

How to add initial data to SQLite database?

I need to add initial values to SQLite database, once application is started first time. How should I do it?

Answer Source

In class file you can do that.

    public void onCreate(SQLiteDatabase db) {
        db.execSQL("insert into " + DATABASE_TABLE3 + "(" + KEY_ROWID + ","
                + KEY_DEF + ") values(1,'')");

Like this type.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download