Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update LiveData value when becoming active #6301

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RemiLatapy
Copy link

Allow LiveData to stay up to date, especially when resuming an activity

It solves this issue: https://stackoverflow.com/questions/49981734/observer-for-android-livedata-not-called-but-it-is-with-observeforever

Allow LiveData to stay up to date, especially when resuming an activity
Copy link
Contributor

@cmelchior cmelchior left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @RemiLatapy
Thank you for doing this 👏

I tested this and it looks like calling it here is correct vs. the constructor as it currently does. However, if we just merge this it will actually set the same value twice when constructing the LiveData, which we want to avoid.

If you remove the call to setValue() in the constructor I think we can merge this.

Also, it looks like you need to sign our CLA: https://github.com/realm/realm-java/blob/master/CONTRIBUTING.md#cla

Copy link
Author

@RemiLatapy RemiLatapy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some changes to avoid double call

@bmunkholm
Copy link
Contributor

@cmelchior Looks like this needs another review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants