我有以下结构。
我得到的结果是0.0。我错在哪里了?
root
-sections
-section1
-student1
-GPA
-lastname
-student2
-GPA
-lastname
-section2
-student1
-GPA
-lastname
我需要获得用户所需学生的GPA。
我正在这样做:
String student = student.getText().toString(); //Student1/Student2 entered
String section = section.getText().toString();
//This is Section1, Student1, say (obtained from EditText)...
然后我在进行
myref = FirebaseDatabase.getInstance().getReference().child("sections");
myref1 = myref.child(section).child(student).child("GPA");
myref1.addValueEventListener(new ValueEventListener() {
public void onDataChange(DataSnapshot dataSnapshot) {
String gpa = dataSnapshot.getValue().toString();
}
public void onCancelled(DatabaseError databaseError) {}
});
我得到的结果是0.0。我错在哪里了?