I have been this answer for insert initial data in native mode
How to add initial data to SQLite database?
How can I get the same result using Green dao?
this is my Application class
public class App extends Application{
@Override
public void onCreate() {
super.onCreate();
DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(this,"Images-bd",null);
SQLiteDatabase db = helper.getWritableDatabase();
DaoMaster daoMaster = new DaoMaster(db);
DaoSession daoSession = daoMaster.newSession();
}
}
You can create a class that extends
DaoMaster
and run your queries insideonCreate
method:So, in your
Application
class, you will use a instance of this class: