Firebase中的setValue()方法在更新子级时缺少一些数据-Android

时间:2019-01-14 11:42:36

标签: android firebase firebase-realtime-database

我的代码可以很好地用新数据更新选定的孩子,但现在不行!

我使用调试器来确保数据设置正确,并且我发现数据设置正确,但是在firebase数据库中缺少一些值..如何解决这个问题?

  • 调试器屏幕快照enter image description here

  • 数据库屏幕快照id

我的对象类

RewriteCond %{REQUEST_URI} !^/main/(index\.php)?$
RewriteCond %{REQUEST_URI} !^/main/sub/
RewriteRule (.*) /main/sub/$1 [R,L]

更新方法..

import android.os.Parcel;
import android.os.Parcelable;

import com.google.firebase.database.IgnoreExtraProperties;

@IgnoreExtraProperties
public class Hour implements Parcelable {

    private int hour;
    private boolean available;
    private String userName;
    private String userId;
    private String bookTime;
    private int index;

    public Hour() {
    }

    public static final Creator<Hour> CREATOR = new Creator<Hour>() {
        @Override
        public Hour createFromParcel(Parcel in) {
            return new Hour(in);
        }

        @Override
        public Hour[] newArray(int size) {
            return new Hour[size];
        }
    };

    private Hour(Parcel in) {
        hour = in.readInt();
        available = in.readByte() != 0;
        userName = in.readString();
        userId = in.readString();
        bookTime = in.readString();
        index = in.readInt();
    }

    public int getHour() {
        return hour;
    }

    public boolean isAvailable() {
        return available;
    }

    public String getUserId() {
        return userId;
    }

    public int getIndex() {
        return index;
    }

    public void setAvailable(boolean available) {
        this.available = available;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public void setBookTime(String bookTime) {
        this.bookTime = bookTime;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(hour);
        dest.writeByte((byte) (available ? 1 : 0));
        dest.writeString(userName);
        dest.writeString(userId);
        dest.writeString(bookTime);
        dest.writeInt(index);
    }
}

谢谢

0 个答案:

没有答案