title: Firebase Database get children of specific level android
body: <p>I have the following database structure in Firebase:
  <a href="https://i.stack.imgur.com/0ruQ1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0ruQ1.png" alt="enter image description here"></a></p>
  
  <p>In my app when I launch an activity. I want to get all the <code>level0Node</code>'s nodes only once when the activity is started. This I achieve like this:</p>
  
  <pre><code>rootNode.addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
                  Iterable&lt;DataSnapshot&gt; level0Nodes = dataSnapshot.getChildren();
              }
  
              @Override
              public void onCancelled(DatabaseError databaseError) {}
          });
  </code></pre>
  
  <p>But the problem I am facing is that if any updates occur on the <code>level1Node</code>'s, <code>onDataChanged</code> is invoked again which I do not want. How can I achieve this?</p>