Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

Android Data Binding issue with Android Annotations #2239

Open
keehoo opened this issue Jul 24, 2019 · 5 comments
Open

Android Data Binding issue with Android Annotations #2239

keehoo opened this issue Jul 24, 2019 · 5 comments

Comments

@keehoo
Copy link

keehoo commented Jul 24, 2019

Hi,
An activity is annotated with @DataBound.
I create my view model in at the end of @injected and start my network call, which changes the value of LiveData in doOnSubsribe and onSuccess/onError

I set this ViewModel as the data in Binding. in initGUI with binding.setViewModel(model)

Expected.
The view should observer the live data when I declare such in xml. for instance:
bind:visibility="@{viewModel.isLoading}

Observed behaviors:
The live data changes correctly, the setValue method is called, but view does not react on those changes.

AndroidAnnotations version: 4.6

Android compile SDK version: 28

@MohamedGamalFci
Copy link

Did you write this line:
binding.setLifecycleOwner(this)

I think it'll solve your problem.

@keehoo
Copy link
Author

keehoo commented Aug 21, 2019

@MohamedGamalFci cheers mate! it worked. Why isn't this called by the library? I guess we'll never know.

@keehoo keehoo closed this as completed Aug 21, 2019
@WonderCsabo
Copy link
Member

WonderCsabo commented Aug 21, 2019

@keehoo the lifecycle owner was introduced later then the data binding support here. But we can add this of course.

@WonderCsabo WonderCsabo reopened this Aug 21, 2019
@MohamedGamalFci
Copy link

@WonderCsabo Thanks for your speedy reply, waiting for the new release :)

@WonderCsabo
Copy link
Member

All contributions are welcome. ;)

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

No branches or pull requests

3 participants