这是我在Android上的代码(不起作用) - >错误 -
com.firebase.client.FirebaseException: Failed to bounce to type at
com.firebase.client.DataSnapshot.getValue(DataSnapshot.java:183) at
ua.deti.cm.pt.livingcity.MainFragment$1.onDataChange(MainFragment.java:83) at
com.firebase.client.core.ValueEventRegistration.fireEvent(ValueEventRegistration.java:45)
---- code ----
Firebase.setAndroidContext(getActivity().getApplicationContext());
Firebase mRef;
mRef = new Firebase("https://livingcityapp.firebaseio.com");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String currentDateandTime = sdf.format(new Date());
Firebase usersRef = mRef.child(currentDateandTime);
HashMap<String, Object> mapaCompleto = new HashMap<>();
usersRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Log.i("There are", dataSnapshot.getChildrenCount() + "dados");
for (DataSnapshot postSnapshot: dataSnapshot.getChildren()) {
FireBaseDataClass post = postSnapshot.getValue(FireBaseDataClass.class);
Log.i("o que é isto?", post.getHora()+ " - " + post.getTemperature()+ " - " + post.getHumidade());
}
}
@Override
public void onCancelled(FirebaseError firebaseError) {
Log.i("The read has failed", firebaseError.getMessage());
}
});
---link to Firebase -> https://livingcityapp.firebaseio.com/