Firebase won't bind boolean value to field

Jschools

I'm using Google's firebase-database SDK for Android, v9.0.1. I have my app hooked up to Firebase and can read and write data at various locations.

However, I cannot get a specific boolean field to bind using dataSnapshot.getValue(PingReport.class) and I keep getting an error in my logs that says No setter/field for isUp found on class com.myapp.PingReport when the field clearly exists in my model.

Here's the JSON in the Firebase database:

{
    "durationMs": 364,
    "isUp": true,
    "timestampMillis": 1464916019971
}

and here's the model class:

public class PingReport {

    private long durationMs;
    private boolean isUp;
    private long timestampMillis;

    public PingReport() {
        // required by Firebase
    }

    public PingReport(long durationMs, boolean isUp, long timestampMillis) {
        this.durationMs = durationMs;
        this.isUp = isUp;
        this.timestampMillis = timestampMillis;
    }

    public long getDurationMs() {
        return durationMs;
    }

    public boolean isUp() {
        return isUp;
    }

    public long getTimestampMillis() {
        return timestampMillis;
    }
}

If I call getDurationMs() or getTimestampMillis() the correct values are returned, but the value returned from isUp() is always false. I have tried different combinations of naming it up and isUp and mUp and adding setters setUp(boolean up) and setIsUp(boolean isUp), but nothing seems to work. The documentation for the Android SDK not very detailed. Is there some trick or detail I'm overlooking?

Bob Snyder

If your boolean field is named isUp, then the getter must be named isIsUp() or getIsUp(). Alternatively, if you want a getter named isUp, the field name would be up.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Form boolean attribute won't change value after submission

From Dev

ReportViewer won't bind

From Dev

Angular.js ng-style won't bind value

From Dev

Django ModelForm won't allow Null value for required field?

From Dev

AngularJS Expression Won't Evaluate in Value Field of Input

From Dev

Javascript radio button value won't parse to PHP hidden field

From Java

SelectedItem won't bind to property

From Dev

Function _.bind() won't bind an object

From Dev

Angular directive won't update boolean

From Dev

Pandas boolean Series won't plot

From Dev

Angular directive won't update boolean

From Dev

xpages bind a field with default value

From Dev

how to bind value in to hidden field

From Dev

xpages bind a field with default value

From Dev

Cordova with Firebase won't work

From Dev

Cordova with Firebase won't work

From Dev

Topic Won't Save in Firebase

From Dev

WPF ObservableCollection won't bind to ListBox

From Dev

Angularjs won't bind scope variable with function?

From Dev

AngularJS Chaining Promises won't bind to template

From Dev

Angularjs won't bind scope variable with function?

From Dev

Polymer, template won't evaluate true and bind

From Dev

form_for won't pass value of select field to controller? Rails 4

From Dev

Boosting elasticsearch based on boolean field value

From Dev

Listbox won't display value

From Dev

KnockoutJS, Text vs Value Binding. Why Text Binding Doesn't Bind to an Input Field?

From Dev

Schrodinger's Object: WPF property won't bind/update unless I check its value code-side?

From Dev

Can I Use Ninject To Bind A Boolean Value To A Named Constructor Value

From Dev

Width of input field won't reduce

Related Related

HotTag

Archive