Retrieving data from the firbase realtime database appear as blanks in the required fields

I am creating an android app using android studio and firebase realtime database. I stored data in the firebase realtime database using UID from authentication. database structure

But when i trying to retrieve the data, the required fields on my app doesn't show any data. They appears to be blanks. Earlier i did this successfully using some other key i have generated through android studio. Then due to some issues i changed it to this authentication uid that firebase provides. Then i have changed the codes to match that.

But when i changed the part where i used to retrieve and show the data, it doesn't seems working. The data doesn't show up. Every other things works fine as i want. I cant figure out the reason for this matter. This is the the part of the code i mentioned.

private void ImportData(){

        usrRF.addValueEventListener(new ValueEventListener() {

            String fullName, userName, userName2, eMail, phoneNum, catG, paSS;
            public void onDataChange(@NonNull DataSnapshot snapshot) {

                fullName = snapshot.child("fname").getValue(String.class);
                userName = snapshot.child("uname").getValue(String.class);
                userName2 = snapshot.child("uname").getValue(String.class);
                eMail = snapshot.child("email").getValue(String.class);
                phoneNum = snapshot.child("pnumber").getValue(String.class);
                catG = snapshot.child("spin").getValue(String.class);
                paSS = snapshot.child("pword").getValue(String.class);




            public void onCancelled(@NonNull DatabaseError error) {


In here

usrRF = FirebaseDatabase.getInstance().getReference().child("users");

When i add "child(uid)" to the code, app gets crashed. Android studio was saying that the path cannot be accessed. (for a user to open this activity from the app, he should be signed in first.)

I will be really grateful for any help.

Read more here:

Content Attribution

This content was originally published by Shehara_r at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: