Skip to content

Instantly share code, notes, and snippets.

@janishar
Created February 13, 2017 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janishar/c9df766505ade199b45e2d824af88ec5 to your computer and use it in GitHub Desktop.
Save janishar/c9df766505ade199b45e2d824af88ec5 to your computer and use it in GitHub Desktop.
public class DemoApp extends Application {
private DaoSession mDaoSession;
@Override
public void onCreate() {
super.onCreate();
mDaoSession = new DaoMaster(
new DaoMaster.DevOpenHelper(this, "greendao_demo.db").getWritableDb()).newSession();
// USER CREATION FOR DEMO PURPOSE
if(mDaoSession.getUserDao().loadAll().size() == 0){
mDaoSession.getUserDao().insert(new User(1L, "Janishar Ali","", ""));
}
}
public DaoSession getDaoSession() {
return mDaoSession;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment