I am trying to implement data binding example in android and creating a POJO with bindable variables and i am getting this error ! please help. I am following this tutorial http://www.vogella.com/tutorials/AndroidDatabinding/article.html and here is my code
import android.databinding.BaseObservable;
import android.databinding.Bindable;
public class TemperatureData extends BaseObservable {
private String location;
private String celsius;
public TemperatureData(String location, String celsius) {
this.location = location;
this.celsius = celsius;
}
@Bindable
public String getCelsius() {
return celsius;
}
@Bindable
public String getLocation() {
return location;
}
public void setLocation(String location){
this.location = location;
notifyPropertyChanged(BR.location);
}
public void setCelsius(String celsius) {
this.celsius = celsius;
notifyPropertyChanged(BR.celsius);
}
}
You should add these lines of code to your app level gradle file as written in the 1.2 section
android {
....
dataBinding {
enabled = true
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With