Reactive extensions were the most wanted feature since ObjectBox was announced. We reacted with ObjectBox 0.9.8 and bring you reactive data observers and RxJava 2 integration. Here’s an example of what you can do with out of the box APIs (no RxJava involved):
1 2 |
Query<Task> query = taskBox.query().equal(Task_.complete, false).build(); query.subscribe().on(AndroidScheduler.mainThread()).observer(data -> updateUi(data)); |
These two lines keep the observer up to date with query results fresh from the database. This example is taken from the new reactive documentation, where the example is explained in more detail. The documentation also covers the new RxJava 2 library for ObjectBox, which also got its own GitHub repository.
Version 0.9.8 also brings Query improvements and bug fixes. For details, please check the change log.
ObjectBox is a new superfast mobile database. It is currently in beta.
Spread the love