public class GreenDaoHelper {
private static GreenDaoHelper greenDaoHelper;
private DaoMaster.DevOpenHelper devOpenHelper;
public GreenDaoHelper(Context context) {
devOpenHelper = new DaoMaster.DevOpenHelper(context, "books.db", null);
}
public static synchronized GreenDaoHelper openHelper(Context context) {
if (greenDaoHelper == null) {
synchronized (GreenDaoHelper.class) {
if (greenDaoHelper == null) {
greenDaoHelper = new GreenDaoHelper(context);
}
}
}
return greenDaoHelper;
}
public SQLiteDatabase getRead() {
return devOpenHelper.getReadableDatabase();
}
public SQLiteDatabase gerWriter() {
return devOpenHelper.getWritableDatabase();
}
}
网友评论