Firebase-Database inconsistence data being stored on database in Android
<p>I'm new to firebase. i'm trying to store some data in Firebase-database in the given format:</p>

<pre><code>approot{
uid{
name:"name"
add:"add"
phn:"phn"
}
uid2{
name:"name"
add:"add"
phn:"phn"
}
.......
</code></pre>

<p>and so on.
for this i have written the following code:</p>

<pre><code>String phn = inputPhn.getText().toString().trim();
        String add = inputAdd.getText().toString().trim();
        String name = inputName.getText().toString().trim();

        if (TextUtils.isEmpty(name)) {
            Toast.makeText(getApplicationContext(), "Enter name!", Toast.LENGTH_SHORT).show();
            return;
        }

        if (TextUtils.isEmpty(phn)||phn.length()!=10) {
            Toast.makeText(getApplicationContext(), "Enter phone no.!", Toast.LENGTH_SHORT).show();
            return;
        }

        if (TextUtils.isEmpty(add)) {
            Toast.makeText(getApplicationContext(), "Enter address!", Toast.LENGTH_SHORT).show();
            return;
        }
        //String info="Name:"+name+"\n"+"PhoneNo:"+phn+"\n"+"Adress:"+add+"\n";
        String uId=auth.getCurrentUser().getUid();
        myref.child(uId).child("name").setValue(name);
        myref.child(uId).child("add").setValue(add);
        myref.child(uId).child("phone").setValue(phn);
        myref.child(uId).child("end").setValue("end");
        auth.signOut();
</code></pre>

<p>my problem is that i'm getting in-consistent data storage in firebase database. the data stored in database is this :</p>

<pre><code>{
  "User" : {
    "ANj8GLEJS9alW11QYQyF8Rykwyn2" : {
      "add" : "hzjs",
      "name" : "hxjx"
    },
    "b0ZBftQ5UOOtTtzkeZHcC0558MC3" : {
      "add" : "gw",
      "name" : "hs"
    },
    "eH6rCXzvEncTe163N7KaJ7XEZp52" : {
      "name" : "dudj"
    },
    "gEqc92Z0mvcfIWvhZu7QOhRcnNQ2" : {
      "add" : "bsus",
      "name" : "jziz",
      "phone" : "1234567890"
    },
    "kGF2PalHrpeFus6682z55p47YBg2" : {
      "add" : "hdud",
      "name" : "jdhd"
    },
    "nHRt5n5roGfU3QogVUM09HDBrIw2" : {
      "add" : "qwerty",
      "end" : "end",
      "name" : "q",
      "phone" : "1234567860"
    },
    "pRRzexjQN1eynoCQcoClNl2TcHk2" : {
      "add" : "dvjh",
      "name" : "rhid"
    },
    "vaek3Z4eEVTWmc722T92tfgBwaE3" : {
      "add" : "dhudvj",
      "name" : "gsbud"
    },
    "xsH5JoTXftaxicUmvntt0N5hcNJ3" : {
      "add" : "zhs",
      "name" : "q"
    }
  }
}
</code></pre>

<p>please help me. <br>
<b>Edit</b>
<br>
i'm using firebase 9.2.1.
and the rules defined are:-</p>

<pre><code>{
  "rules": {
    ".read": "auth != null",
    ".write": "auth != null"
  }
}
</code></pre>