If I understand correctly, when working with DB, I have to do as follows
DaoMaster.OpenHelper helper = new DaoMaster.OpenHelper(this, "test-db", null) {
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
};
SQLiteDatabase db = helper.getWritableDatabase();
DaoMaster daoMaster = new DaoMaster(db);
daoSession = daoMaster.newSession();
But if I try to do this in classes that aren't extending activity or service, I simply couln't pass their context.
What is right approach to open my DB? Where should it be done?
If you can provide some tutorial links besides official greendao (I couldn't find the answer there), it would be great.