I'v got an exception after I call put()
with my data list.
I know that I closed the box before with a reason (deleteAllFiles() must be closed).
How should I open it again? As I see, dataBoxStore is not null after I closed it.
My code:
dataBoxStore = MyObjectBox.builder().androidContext(this).name("DB").build();
dataBoxStore.close();
dataBoxStore.deleteAllFiles();
final Box<Data> areaLocationBox = dataBoxStore.boxFor(Data.class);
areaLocationBox.put(myList);
Exception:
Caused by: java.lang.IllegalStateException: Store is closed
at io.objectbox.BoxStore.checkOpen(BoxStore.java:261)
at io.objectbox.BoxStore.beginTx(BoxStore.java:310)
at io.objectbox.Box.getWriter(Box.java:107)
at io.objectbox.Box.put(Box.java:389)