public class SubApplication extends Application {
private DaoSession daoSession; private static SubApplication subApplication;public void onCreate() {
getDatabase();
subApplication = this;
super.onCreate();
}
public static SubApplication getInstance(){ return subApplication; }private void getDatabase() {
DaoMaster.DevOpenHelper openHelper = new DaoMaster.DevOpenHelper(this, "zuoye"); SQLiteDatabase database = openHelper.getWritableDatabase(); DaoMaster daoMaster = new DaoMaster(database); daoSession = daoMaster.newSession(); } public DaoSession getDaoSession(){ return daoSession; } }