[英]ORMLite on Android not calling onCreate
Using ORMLite v 4.40, I try to get my app running, but it seems to ignore the onCreate function 使用ORMLite v 4.40,我尝试让我的应用程序运行,但它似乎忽略了onCreate函数
My DatabaseHelper looks like this (snippet style) 我的DatabaseHelper看起来像这样(片段样式)
public class ORMLiteHelper extends OrmLiteSqliteOpenHelper {
private Context databaseContext;
private static String DATABASE_NAME = "InVinoVeritas";
private static int DATABASE_VERSION = 1;
public ORMLiteHelper(Context context) {
super (context, DATABASE_NAME, null, DATABASE_VERSION);
Log.v("ORMLiteHelper", "Cosntructor");
...
@Override
public void onCreate(SQLiteDatabase database, ConnectionSource connectionSource) {
Log.v("DatabaseHelper", "onCreate");
...
@Override
public void onUpgrade(SQLiteDatabase database, ConnectionSource connectionSource, int oldVersion, int newVersion) {
Log.v("DatabaseHelper", "onUpgrade");
...
My MainActivity calls the DatabaseHelper as described: 我的MainActivity调用DatabaseHelper,如下所述:
public class MainActivity extends OrmLiteBaseActivity<ORMLiteHelper> {
I have tried re-installing the application, upgrading the database version, nothing works. 我试过重新安装应用程序,升级数据库版本,没有任何作用。 I do see the constructor call (including typo :-), the onCreate and onUpgrade however are not called.
我确实看到了构造函数调用(包括拼写错误:-),但是onCreate和onUpgrade却没有被调用。
Any help appreciated 任何帮助赞赏
Barry 巴里
Create instance of ORMLiteHelper
and call getWritableDatabase()
. 创建
ORMLiteHelper
实例并调用getWritableDatabase()
。 When database is not created then onCreate will be invoked. 如果未创建数据库,则将调用onCreate。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.