Async queries

suggest change

Every synchronous query method (such as findAll() or findAllSorted()) has an asynchronous counterpart (findAllAsync() / findAllSortedAsync()).

Asynchronous queries offload the evaluation of the RealmResults to another thread. In order to receive these results on the current thread, the current thread must be a looper thread (read: async queries typically only work on the UI thread).

RealmChangeListener<RealmResults<SomeObject>> realmChangeListener; // field variable

realmChangeListener = new RealmChangeListener<RealmResults<SomeObject>>() {
    public void onChange(RealmResults<SomeObject> element) {
        // asyncResults are now loaded

RealmResults<SomeObject> asyncResults = realm.where(SomeObject.class).findAllAsync();

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents