SnowdogApps / DataBindingSample

Sample app shows how to use Data Binding in Android.
Apache License 2.0
5 stars 2 forks source link

Data binding with library #1

Open patelakshay13890 opened 8 years ago

patelakshay13890 commented 8 years ago

Hey developers, How can I use data binding in my application because I am new to data binding concept ? I have an application module and one android lib. Module which has all the entites those are used in app module l.. So how can I use data binding in my app with lib. Module.. Which also include dynamic inflation of view based on parameter in some of the entities in library module 

KamilBalwierz commented 8 years ago

Here is a link to original blog post related with this sample code: https://snow.dog/blog/android-data-binding/

patelakshay13890 commented 8 years ago

I am not able to use BaseObservable class from Data binding library in my android library module although I can use @Bindable anonation in my entity's field but for that field I can't use notifyProperty() method also l.. So what could be the solution for that ?

bartektrail commented 8 years ago

Hey, You can use ObservableField instead of extending from BaseObservable. For example: public final ObservableField<String> firstName = new ObservableField<>(); and then access using: firstName.set("Google"); firstName.get();

My code was working on beta version of Data Binding. Please check official documentation https://developer.android.com/topic/libraries/data-binding/index.html