亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

com.google.firebase.database.DatabaseException:

com.google.firebase.database.DatabaseException:

一只甜甜圈 2023-05-10 14:24:28
按照 firebase 數據庫的文檔嘗試將數據檢索到對象以供使用時,我收到錯誤消息。這是我的對象模型public class Cart {    private String pid, pname, price, discount, quantity;    public Cart() {    }    public Cart(String pid, String pname, String price, String discount, String quantity) {        this.pid = pid;        this.pname = pname;        this.price = price;        this.discount = discount;        this.quantity = quantity;    }    public String getPid() {        return pid;    }    public void setPid(String pid) {        this.pid = pid;    }    public String getPname() {        return pname;    }    public void setPname(String pname) {        this.pname = pname;    }    public String getPrice() {        return price;    }    public void setPrice(String price) {        this.price = price;    }    public String getDiscount() {        return discount;    }    public void setDiscount(String discount) {        this.discount = discount;    }    public String getQuantity() {        return quantity;    }    public void setQuantity(String quantity) {        this.quantity = quantity;    }}最后,我得到錯誤的代碼和行被注釋掉了。
查看完整描述

1 回答

?
函數式編程

TA貢獻1807條經驗 獲得超9個贊

和是您的 firebase 數據庫中的值quantity,在您的類中它被聲明為. 這是拋出錯誤。像下面這樣聲明類。discountLongCartStringCart


public class Cart {


    private String pid, pname, price;

    private Long discount, quantity;


    public Cart() {

    }


    public Cart(String pid, String pname, String price, Long discount, Long quantity) {

        this.pid = pid;

        this.pname = pname;

        this.price = price;

        this.discount = discount;

        this.quantity = quantity;

    }


    public String getPid() {

        return pid;

    }


    public void setPid(String pid) {

        this.pid = pid;

    }


    public String getPname() {

        return pname;

    }


    public void setPname(String pname) {

        this.pname = pname;

    }


    public String getPrice() {

        return price;

    }


    public void setPrice(String price) {

        this.price = price;

    }


    public Long getDiscount() {

        return discount;

    }


    public void setDiscount(Long discount) {

        this.discount = discount;

    }


    public Long getQuantity() {

        return quantity;

    }


    public void setQuantity(Long quantity) {

        this.quantity = quantity;

    }

}

希望能解決您的問題。


查看完整回答
反對 回復 2023-05-10
  • 1 回答
  • 0 關注
  • 182 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號