Firebaseexception: Failed To Bounce To Type In Android But Model Class Properties And Json Properties Are Same
I'm still getting an exception: com.firebase.client.FirebaseException: Failed to bounce to type exception for following line Peoples people = dataSnapshot.getValue(Peoples.class)
Solution 1:
Since you're listening to a value
event, the onDataChange
method can potentially be called with multiple matching items. Even though in your case there is only one match, your code will need to be prepared to handle multiple:
publicvoidonDataChange(DataSnapshot dataSnapshot) {
System.out.println("There are " + dataSnapshot.getChildrenCount() + " children");
for (DataSnapshot child: dataSnapshot.getChildren()) {
Peoples people = child.getValue(Peoples.class);
System.out.println("Child: " + people.getEmailid());
}
}
Alternatively, you can add a ChildEventListener. https://www.firebase.com/docs/android/guide/retrieving-data.html
Post a Comment for "Firebaseexception: Failed To Bounce To Type In Android But Model Class Properties And Json Properties Are Same"