Android Realm ChangeListener not being triggered
You need to keep a class reference to entries
to prevent it from being GC'ed:
public MyClass {
private RealmResults<LogEntry> entries;
public void myMethod() {
entries = realm.where(LogEntry.class).findAll();
entries.addChangeListener(new RealmChangeListener<RealmResults<LogEntry>>() {
@Override
public void onChange(RealmResults<LogEntry> results) {
Log.v("Testing", "The size is: " + results.size());
}
});
}
}