Having multiple SQLiteOpenhelper in one Android application

I would like to know if it is possible to have multiple DbOpenHelper in the same Android application, but use them to write and read in the same database? because I'm trying to create tables from two different OpenHelper (with different names), and only the first is created. when I try to start the second, I get an error message ...

+6
android sqlite
source share
2 answers

It looks like you cannot have more than one helper for each database. This explains why: http://blog.foxxtrot.net/2009/01/a-sqliteopenhelper-is-not-a-sqlitetablehelper.html

+11
source share

Add a TABLE_CREATE to onOpen(SQLiteDatabase db) to ensure that a second table is created if the database connection is already open. In addition, the TABLE_CREATE must include IF NOT EXIST if the table already exists.

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

0
source share

All Articles