I have some problem about reading value in Firebase Database, This is structure of Realtime Database, sorry I wasn't allowed to embedded picture:
This is my Object class, also contains Constructor, Getter and Setter:
public class ScheduleObject {
private String TimeEnd;
private String TimeStart;
private Boolean isActive;
...
}
When I use dataSnapshot.getValue(ScheduleObject.class), I will get values from TimeEnd and TimeStart but isActive is always return null. Seem like it didn't get the value on Firebase but I don't know why?
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
scheduleObject = new ScheduleObject();
scheduleObject = dataSnapshot.getValue(ScheduleObject.class);
}
}
Only when I use dataSnapshot.child("isActive").getValue(Boolean.class) its will return value from Firebase. Thanks for any help!
option 1) if your boolean field is named as isActive, then the getter must be named as isIsActive() or getIsActive()
option 2) if you want a getter isActive, the field name would be active only