Search code examples
androidlisteneronchangerealm

How to get specific changes from ChangeListener in Realm


Im trying to use the Realm-Database for my Android App. When I want to use the RealmChangeListener in my realm, it auto-creates the Method "onChange". That means if something is changed in the database, the program executes this method.

I want to get detailed information about what has been changed. That would be so cool!

Does anyone know something about this feature? I'll post the Code below for better understanding of what I'm trying to do.

Greetings, John

Code:

Realm realm =  Realm.getInstance(getApplicationContext()); 
realmListener = new RealmChangeListener() {
    @Override
    public void onChange() {
    Log.i("realmtest","some values in the database have been changed");
}};
realm.addChangeListener(realmListener);

Solution

  • Fine grained notifications are now supported.

    Source 1

    Sample recyclerview