My Firebase Database structure is as follows :
Multiple user details will be stored in this database. How to access this detail in my app?
Do you want to access the 'nAc...13' again? and others data? That thing is seen as a uid. If you created the database using auth, use firebase.auth().uid
to access it.
If you use Firebase user get to store data as uid of user so you can reuse this data with
private DatabaseReference mFirebaseDatabaseReference;
private DatabaseReference mFirebaseDatabaseRefrence_user;
private FirebaseAuth mFirebaseAuth;
private FirebaseUser mFirebaseUser;
private String userUid;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat);
mFirebaseAuth = FirebaseAuth.getInstance();
mFirebaseUser = mFirebaseAuth.getCurrentUser();
mFirebaseDatabaseReference = FirebaseDatabase.getInstance().getReference();
mFirebaseDatabaseRefrence_users = mFirebaseDatabaseReference.child(userUid);
ValueEventListener users = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {}
@Override
public void onCancelled(DatabaseError databaseError) {}
};
mFirebaseDatabaseRefrence_user.addValueEventListener(users);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.