title: Firebase retrieve child Android
body: <p>I am accessing Firebase on Android. I want to retrieve a child from the tree. My code is (updated)</p>
  
  <pre><code>         f.child("Germany").child("Username").child("Alan Turing").addChildEventListener(new ChildEventListener() {
          // Retrieve new posts as they are added to Firebase
          @Override
          public void onChildAdded(DataSnapshot snapshot, String previousChildKey) {
              Map&lt;String, Object&gt; newPost = (Map&lt;String, Object&gt;) snapshot.getValue();
              System.out.println("Author: " + newPost.get("Message"));
              disp_msg = (TextView)findViewById(R.id.display_msg);
              disp_msg.setText(newPost.get("Message").toString());
             // System.out.println("Title: " + newPost.get("title"));
          }
  </code></pre>
  
  <p>In my firebase I have </p>
  
  <pre><code>Language
    Germany
      Username
        Alan Turing
          Message
            -Jf6ShYy7niHrqg_x4Tc: "tom"
            -Jf9v0xHAxINUUANrORU: "perfect"
  </code></pre>
  
  <p>When I ran the code above I get: </p>
  
  <pre><code>Author: {
    Username={
      Alan Turing={
        Message={
          -Jf6ShYy7niHrqg_x4Tc=tom, 
          -Jf9v0xHAxINUUANrORU=perfect!
        }
      }
    }
  }
  </code></pre>
  
  <p>But I want only the messages, not the entire Firebase database. </p>
  
  <p>So how do I get just the specified child?</p>
  
  <p>only this is working so far but it returns whole firebase:                                               </p>
  
  <pre><code>         f.addChildEventListener(new ChildEventListener() {
          // Retrieve new posts as they are added to Firebase
          @Override
          public void onChildAdded(DataSnapshot snapshot, String previousChildKey) {
              Map&lt;String, Object&gt; newPost = (Map&lt;String, Object&gt;) snapshot.getValue();
              System.out.println("Author: " + newPost.get("Germany"));
              disp_msg = (TextView)findViewById(R.id.display_msg);
              disp_msg.setText(newPost.get("Germany").toString());
             // System.out.println("Title: " + newPost.get("title"));
          }
  </code></pre>
  
  <p>I stored it as follows:</p>
  
  <pre><code>Firebase usersRef = f.child("Language");
  usersRef .child("Germany").child("Username").child("Alan Turing").child("Message").push().setValue(writeMsgField.getText().toString());
  </code></pre>