2017-10-03 6 views
1

firebase를 처음 사용했습니다. 이것은 내 데이터베이스입니다. firebase에서이 데이터를 어떻게 검색합니까? 이 데이터는 사용자가 추가하므로 인큐베이터의 수를 알지 못합니다.firebase에서 데이터를 검색하는 방법

{ 
    Incubators : 
      { 
       Name_of_Incubator1 
       { 
         Contact : 3443354684 
         Founder : "Atul" 
         Email : "[email protected]" 
        } 
       Name_of_Incubator2 
       { 
         Contact : 3444569684 
         Founder : "Anupis" 
         Email : "[email protected]" 
        } 
       . 
       . 
       . 
       . 
      } 
} 

답변

1

Firebase Docs에서 예 :

private DatabaseReference mDatabase; 
// ... 
mDatabase = FirebaseDatabase.getInstance().getReference(); 

ValueEventListener postListener = new ValueEventListener() { 
@Override 
public void onDataChange(DataSnapshot dataSnapshot) { 
    // Get Post object and use the values to update the UI 
    Post post = dataSnapshot.getValue(Post.class); 
    // ... 
} 

@Override 
public void onCancelled(DatabaseError databaseError) { 
    // Getting Post failed, log a message 
    Log.w(TAG, "loadPost:onCancelled", databaseError.toException()); 
    // ... 
} 
}; 
mDatabase.addValueEventListener(postListener); 

당신은 중포 기지와 함께 시작하는이 샘플 프로젝트를 시도 할 수 있습니다 : Friendly Chat

관련 문제