title: Read a particular child value from firebase database
body: <p>I am trying to retrieve value(phone number) for a child from my firebase realtime database. However it gives me the following error:</p>
  
  <blockquote>
    <p>Attempt to invoke virtual method
    'com.google.firebase.database.DatabaseReference
    com.google.firebase.database.DatabaseReference.child(java.lang.String)'
    on a null object reference</p>
  </blockquote>
  
  <p>The structure of my database looks like this: </p>
  
  <pre><code>contactsfirebase-16ade
    users
      -LiKtfTuDQm7LmY49t69
        email: "devsingh0@gmail.com"
        name: "dev"
        phone: "2327272"
  </code></pre>
  
  <p>Code</p>
  
  <pre><code>DatabaseReference databaseReference;
  databaseReference.child("users").child("userID").child("phone").addListenerForSingleValueEvent(new ValueEventListener()
  {
     @Override
     public void onDataChange(@NonNull DataSnapshot dataSnapshot) 
      {
       String phone = dataSnapshot.getValue().toString();
  
       Phone.setText(phone);
       Phone.getDisplay();
      }
  }
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/55697150/read-child-value-from-firebase">Read child value from firebase</a></p>
  
  <p>I want the value "2327272" to be shown in the textview Phone on my app. However when I click the button it gives the error as shared above and the app crashes.</p>