【发布时间】:2018-10-12 04:58:34
【问题描述】:
我正在尝试从 Firebase 检索数据:
DatabaseReference customerRef = FirebaseDatabase.getInstance().getReference("Drivers").child(driverId).child("customerRideId");
Log.d("TAG_SiX",customerRef.toString());
customerRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
// retriveCustomerID(dataSnapshot);
Log.d("TAG_eight",dataSnapshot.toString());
Map<String,String> map =
(Map<String,String>)dataSnapshot.getValue();
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
这里是logcat值
D/TAg_five: DataSnapshot { key = customerRideId, value = null }
05
这是 Firebase 数据结构,我想要 customerRideId 的值,它在 logcat 中显示为 null,并且 customerRideId 在 DriverID 中。
Drivers
PyltxOLXcWfZf6itgJEMWC4ylDu2
driverEmail: "nishant@gmail.com"
driverName: "Nishant"
customerRideId: "Sqpb6RFNhMOSiXeCrYj83aeeG7r2"
我想检索 customerRideId 的值,但在 logcat 中它显示空值请帮助我。
here is the database screenshot
【问题讨论】:
标签: android database firebase null return