0
I have the following tree on Firebase:
How do I access to list the data within the node "holes"?
I am using the following data listing method:
public void recuperaFuros(){
DatabaseReference furosRef = firebaseRef
.child(idUsuario.toString())
.child("vhykFsTJMhaCd6jkBd3oXpmYoiH2Thu Jan 10 22:54:24 GMT-02:00 2019")
.child("furos")
.child("Thu Jan 10 22:54:51 GMT-02:00 2019");
furosRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
furos.clear();
for(DataSnapshot ds: dataSnapshot.getChildren()){
furos.add(ds.getValue(Furo.class));
//System.out.println("PROJETO" + ds.getValue());
}
adapterFuros.notifyDataSetChanged();
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
but my return is being:
Can't convert object of type java.lang.String to type geoapp.cursoandroid.com.geoapp.model.Furo
on the line
furos.add(ds.getValue(Furo.class));
My rules are like this:
{
"rules": {
".read" : true,
".write" : true
}
}
The error disappeared, however, my Recycler does not bring the data back
– user135345
If I delete the line that gives error and debug with System.out.println(ds.getValue) it brings my data back
– user135345
Then this problem has been solved and you can accept the answer. Ask another question if you cannot solve the other problem!
– Costamilam