mardi 17 mars 2015

GreenDao use existing database instead of creating one


Vote count:

0




I am using green dao and I came to a point in wich I am supporting multilanguage and I would like to use diffrent databases for each language.


Till now I have been creating my database by using green dao. Now I would like to have multiple databases insite assets and just open the one I need and manipulate it with green dao.


How can I do that?


This is my method for creating the database:



public static DaoMaster getDaoMaster(Context context)
{
if(daoMaster == null)
{
OpenHelper helper = new OpenHelper(context, "dbSlo", null) {
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}

};
//DevOpenHelper helper = new DevOpenHelper(context, "tronpos-db", null);
db = helper.getWritableDatabase();
daoMaster = new DaoMaster(db);
}

return daoMaster;
}


Now instead of creating one I want to open an existing (dbSlo that I gave in assets) and then manipulate with it normaly.



asked 55 secs ago







GreenDao use existing database instead of creating one

Aucun commentaire:

Enregistrer un commentaire