문제

I'm pretty new using ORMLite with android, and I read in this question that the method onCreate() of the class OrmLiteSqliteOpenHelper is not called when the database already exists... but I'd like to confirm it by myself, does anyone know how to check if the database exists?

도움이 되었습니까?

해결책

It looks like OrmLiteSqliteOpenHelper inherits the getWritableDatabase() method from SQLiteOpenHelper. If that method returns null, then the database does not exist.

다른 팁

You can also create a database by using SQLiteDatabase for example

SQLiteDatabase = StackOverFlowDB;
//Creating database
    StackOverFlowDB = MainActivity.this.openOrCreateDatabase("StackOverFlow", MODE_PRIVATE, null);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top