Giter Club home page Giter Club logo

Comments (2)

rorbech avatar rorbech commented on June 1, 2024

Hi @rhysll34. There is a lot of non-Realm code in play in our report. Could you try to boil you example down to minimal example showing your issue and leave out all non-Realm related (e.g. first element, flatmap, visitors, etc.).

from realm-java.

rhysll34 avatar rhysll34 commented on June 1, 2024

I have added some code to my project to create a minimal example. The code below reflects what I have added. As I interact with the UI the result of Visit::getVisitStatus() should change between various string values, and I would expect to see each new value appear in Logcat. This doesn't always happen. I am fairly certain that the updates are being persisted into Realm. The Visit object is being updated by setting the field value of the object within a Realm transaction. Causing the method below to be caused again will result in the correct value to be retrieved.

class RealmDB {
    RealmObject visit;
    private final Realm realm;

    ...

    public void getVisit(int visitId) {
        visit = realm.where(Visit.class)
            .equalTo("key", visitId).findFirstAsync();

        visit.addChangeListener(a -> {
            Visit visitB = (Visit)a;
            Timber.d("Visit status: %s", visitB.getVisitStatus());
        }); 
    }

    ....
}

The instance of RealmDB should remain in scope while the Activity is still running.

from realm-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.