android - Why does DbFlow can not save objects without being assigned to a variable? -
code below works expected
customer x = new customer(); x.name = "yasin"; x.save();
but leads app crash
new customer() { { name = "yasin"; } }.save();
error detail in logcat:
com.raizlabs.android.dbflow.structure.invaliddbconfiguration: table: com.example.yasin.myapplication.mainactivityfragment$1$1 not registered database. did forget @table annotation?
why happen? bug dbflow or there don't know java language?
the error getting because in second case extending customer class using anonymous class , dbflow require classes manages annotated, not case anonymous class created. leads error. solution add constructor taking name parameter can like: new customer("the name").save();
Comments
Post a Comment