title: How to retrieve value of a field in Firebase?
body: <p><a href="https://i.stack.imgur.com/rvbur.jpg" rel="nofollow"><img src="https://i.stack.imgur.com/rvbur.jpg" alt="enter image description here"></a></p>
  
  <p>Say I have above Firebase Database. I want to get the contact object and each of the fields using the Firebase Auto-Generated Key. How to do it?</p>
  
  <p>I imagined something like:</p>
  
  <pre><code>Query ref = FirebaseDatabase.getInstance().
      getReference("contacts").orderByKey().equalTo("-KTwyKpIifsYAZiZd861");
  </code></pre>
  
  <p>And maybe use it like this : <strong>(Btw, below is not the actual code, since getValue() doesn't exist. It's just to represent what I'm trying to do.)</strong></p>
  
  <pre><code>String name = ref.getValue("name");
  String city = ref.getValue("city);
  // and so on.
  </code></pre>
  
  <p>So, how to retrieve values of individual fields in Firebase?</p>