【问题标题】:How can I fix the below error in databinding?如何修复数据绑定中的以下错误?
【发布时间】:2019-12-08 15:18:31
【问题描述】:
I am using one Pojo and I am getting databinding error 

Found data binding errors.
****/ data binding error ****msg:Could not find accessor com.jmr.agency.banking.data.db.communication.CommTransaction.dName
file:C:\Users\1432\Documents\Pooja\my_proj\Aman_bank300719\Agency_Banking_Rewamp\app\src\main\res\layout\activity_receive_money_security_task.xml
loc:183:68 - 183:87
****\ data binding error ****

this is my code
ActivityReceiveMoneySecurityTaskBinding binding;

this is my xml
`<data>
        <import type="android.view.View" />
<variable
            name="security_check" type="com.jmr.agency.banking.data.db.communication.CommTransaction" />
    </data>`

    public class CommTransaction extends CommAgent
                        implements Parcelable { 
        private Double txnAmount;
        private String transId; 
        // RefId 
        private String serverTxnId; 
        // CBS 
        private String dBranch; 
        private String cBranch;
        private String dAccountNo; 
        private String dName; 
        private String dLoc; 
        private String dCurrency
    }

【问题讨论】:

  • 这是我的模型 pojo public class CommTransaction extends CommAgent implements Parcelable { private Double txnAmount;私有字符串 transId; // RefId 私有字符串 serverTxnId; // CBS 私有字符串 dBranch;私有字符串 cBranch;私人字符串 dAccountNo;私有字符串 dName;私有字符串 dLoc;私人字符串 dCurrency;
  • 也发布您的 xml 代码。

标签: android


【解决方案1】:

错误似乎是 Android 数据绑定在查看公共字段之前先寻找 getter。在您的代码中,没有字段具有 getter 和 setter。 请通过添加 getter 和 setter 来修改 CommTransaction 类。 这将解决您的错误。

【讨论】:

  • 在那里我没有提到整个pojo
  • 所有字段的getter setter和parcelable
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-07
  • 2017-10-11
  • 1970-01-01
  • 2023-02-09
相关资源
最近更新 更多