Android-无法解析符号BaseObservable [英] Android- Cannot resolve symbol BaseObservable

查看:227
本文介绍了Android-无法解析符号BaseObservable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在android中实现数据绑定示例,并创建具有可绑定变量的POJO,但出现此错误!请帮忙.我正在关注本教程 http://www.vogella.com/tutorials/AndroidDatabinding/article.html 这是我的代码

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);
    }

}

推荐答案

您应该按照 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆