You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
FYReader/app/src/main/java/xyz/fycz/myreader/greendao/GreenDaoManager.java

39 lines
1.0 KiB

package xyz.fycz.myreader.greendao;
import xyz.fycz.myreader.application.MyApplication;
import xyz.fycz.myreader.greendao.gen.DaoMaster;
import xyz.fycz.myreader.greendao.gen.DaoSession;
import xyz.fycz.myreader.greendao.util.MySQLiteOpenHelper;
public class GreenDaoManager {
private static GreenDaoManager instance;
private static DaoMaster daoMaster;
private DaoSession mDaoSession;
private static MySQLiteOpenHelper mySQLiteOpenHelper;
public static GreenDaoManager getInstance() {
if (instance == null) {
instance = new GreenDaoManager();
}
return instance;
}
public GreenDaoManager(){
mySQLiteOpenHelper = new MySQLiteOpenHelper(MyApplication.getmContext(), "read" , null);
daoMaster = new DaoMaster(mySQLiteOpenHelper.getWritableDatabase());
mDaoSession = daoMaster.newSession();
}
public static DaoSession getDaoSession() {
return getInstance().mDaoSession;
}
public DaoSession getSession(){
return mDaoSession;
}
}