Android: Retrieve data of a specific user from a Firebase database

前端 未结 3 1580
深忆病人
深忆病人 2020-12-06 08:43

I am trying to read \"specific\" data from my firebase realtime database. I have seen examples of getting all data from a table and going through it to find the

3条回答
  •  一整个雨季
    2020-12-06 09:10

    Query specific_user = myRef.child(FirebaseAuth.getInstance().getCurrentUser().getUid());
          specific_user.addListenerForSingleValueEvent(
                  new ValueEventListener() {
                  @Override
                  public void onDataChange(DataSnapshot dataSnapshot) {
                         //here you will get the data
                      }
    
                  @Override
                  public void onCancelled(DatabaseError databaseError) {    
                                               }
                               });
    

提交回复
热议问题