Having several SQLiteOpenhelper in one appli Android

后端 未结 2 1681
情书的邮戳
情书的邮戳 2021-02-09 16:29

I would like to know if it is possible to have several DbOpenHelper in the same app Android but to use them to write and read in the same database? because I\'m trying to create

2条回答
  •  野的像风
    2021-02-09 16:49

    Add the TABLE_CREATE statement to onOpen(SQLiteDatabase db) to ensure that the second table gets created in case the database connection is already opened. Further, the TABLE_CREATE statement should include IF NOT EXIST in case the table already exists.

    Reference: http://jiahaoliuliu.wordpress.com/2011/09/26/sqlite-create-multiple-tables-with-different-sqliteopenhelper-in-the-same-database/

提交回复
热议问题