我的火力數據庫的結構是這樣的:檢索從火力地堡Android Studio中
-Details
-BNFJ3491
-Answer: "abc"
-Name: "ABC"
-Password:"cde"
-Security Question: "rgrg"
-User Type: "Student"
-CBTV15873
-Answer: "abc"
-Name: "ABC"
-Password:"cde"
-Security Question: "rgrg"
-User Type: "Student"
-Notices
-B tech placement
-Department: "Urja Mandir"
-Matter: "Hello welcome to btech placement cell"
Firebase ref=new Firebase("https://linkb-873e1.firebaseio.com/Details");
ref.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
//get all the children
for (DataSnapshot child : dataSnapshot.getChildren()) {
for (DataSnapshot child1 : child.getChildren()) {
}
}
}
@Override
public void onCancelled(FirebaseError firebaseError) {
System.out.println("The read failed: " + firebaseError.getMessage());
}
});
我無法弄清楚如何爲一個特定ID獲取密碼(如用於BNFJ3491 )datasnapshot將得到我所有的數據,但我如何檢索有關特定ID的信息。
謝謝你,先生,這段代碼的工作! – sri