答案 0 :(得分:0)
将您的firebase网址更改为
" YourFireBaseUrl/room/cb1201"
获取房间号cb1201的数据
您将获得JSON
格式
答案 1 :(得分:0)
请参阅此链接以获取完整代码 http://www.amalhichri.net/android-firebase-realtime-database-basic-cruds/
private void findperson(String name){ 查询deleteQuery = myDatabaseReference.orderByChild(" fullName")。equalTo(name);
deleteQuery.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
Iterable snapshotIterator = dataSnapshot.getChildren();
Iterator iterator = snapshotIterator.iterator();
while((iterator.hasNext())){
Log.d("Item found: ",iterator.next().getValue().toString()+"---");
}
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}`enter code here`
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
Log.d("Item not found: ","this item is not in the list");
}
});
}