سؤال

What is the best way to close (and reopen) da Database using greenDao ORM?

daoMaster.getDatabase().close()

or

daoSession.getDatabase().close()

and how to reopen?

هل كانت مفيدة؟

نصائح أخرى

This is what I did.

private SQLiteDatabase db; //Global Variable.

Initialize your helper and SQLiteDatabase in onResume method.

DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(this,"YourDBName",null);
db = helper.getWritableDatabase();

close Database onPause

db.close();
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top