Docs Menu

Interface RealmObjectChangeListener

On this page

  • io.realm
  • Method Summary
  • Method Detail
  • onChange

RealmObjectChangeListener can be registered on a RealmModel or RealmObject to receive detailed notifications when an object changes.

Realm instances on a thread without an android.os.Looper cannot register a RealmObjectChangeListener .

Listener cannot be registered inside a transaction.

Tip
See also:
Modifier and Type
Method and Description
public void
T t,
ObjectChangeSet changeSet
)

When this gets called to return the results of an asynchronous query made by RealmQuery.findFirstAsync() , changeSet will be null .

public void onChange (
T t,
ObjectChangeSet changeSet
)

When this gets called to return the results of an asynchronous query made by RealmQuery.findFirstAsync() , changeSet will be null .

When this gets called because the object was deleted, changeSet.isDeleted() will return true and changeSet.getFieldChanges() will return null .

When this gets called because the object was modified, changeSet.isDeleted() will return false and changeSet.getFieldChanges() will return the detailed information about the fields' changes.

If a field points to another RealmObject this listener will only be triggered if the field is set to a new object or null. Updating the referenced RealmObject will not trigger this listener.

If a field points to a RealmList, this listener will only be triggered if one or multiple objects are inserted, removed or moved within the List. Updating the objects in the RealmList will not trigger this listener.

Changes to LinkingObjects annotated RealmResults fields will not be monitored, nor reported through this change listener.

Parameters

  • t - the RealmObject this listener is registered to.
  • changeSet - the detailed information about the changes.
←  Class RealmObjectClass RealmObjectSchema →
Give Feedback
© 2022 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2022 MongoDB, Inc.