有几个SQLiteOpenhelper在一个APPLI的Andr​​oid有几个、SQLiteOpenhelper、APPLI、Andr

2023-09-05 03:54:47 作者:沽酒待人歸

我想知道是否有可能有几个DbOpenHelper在相同的应用程序的Andr​​oid,但使用它们写入和读取在同一个数据库? 因为我想从2个不同的OpenHelper创建表(具有不同名称),只有第一个,似乎创造。当我尝试运行:第二个,我得到一个错误...

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 tables from 2 different OpenHelper (with different names) and only the first one seems to create. when I try to run the 2nd one, i get an error...

推荐答案

看起来像你不能有一个以上的帮手,每个数据库。这里的解释了为什么:http://blog.foxxtrot.net/2009/01/a-sqliteopenhelper-is-not-a-sqlitetablehelper.html

Looks like You can't have more than one helper for each DB. Here's explained why: http://blog.foxxtrot.net/2009/01/a-sqliteopenhelper-is-not-a-sqlitetablehelper.html