title: When I nest two value event listeners, do they both run asynchronously or the the lower one waits for the higher one to be completed?
body: <p>I am working on an android application, using Firebase and Android Studio.
  I had issues with retrieving values with value event listeners because i couldnt set values inside the <code>onDataChange</code> method to be used else where because it runs asynchronously, so the listener may or may not have completed its purpose before the value is needed outside. So I solved this issue by putting whatever needs to be done inside the <code>onDataChange</code> method(real life saver!).</p>
  
  <p>But</p>
  
  <p>the value i am retrieving in the <code>onDataChange</code> also happens to be needed inside another listener. like this</p>
  
  <pre><code> DatabaseReference mLastnameReference = rootRef.child("users").child("12345678").child(phone);
          ValueEventListener lastnameListener = new ValueEventListener() {
              @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
                  try {
                      yourid = dataSnapshot.getValue().toString();
                  }
                  catch (NullPointerException e){
                      //handle user not registered here
  
                  }
  
  
  
  DatabaseReference mBioReference = FirebaseDatabase.getInstance().getReference().child("users").child(yourid).child("status");
                  ValueEventListener bioListener = new ValueEventListener() {
                      @Override
                      public void onDataChange(DataSnapshot dataSnapshot) {
                          Status = dataSnapshot.getValue().toString();
                          mTextField = (TextView) findViewById(R.id.status);
                          mTextField.setText(Status);
  
                      }
  
                      @Override
                      public void onCancelled(DatabaseError databaseError) {
  
                      }
                  };
                  mBioReference.addValueEventListener(bioListener);
   }
              @Override
              public void onCancelled(DatabaseError databaseError) {
  
              }
          };
          mLastnameReference.addValueEventListener(lastnameListener);
  </code></pre>
  
  <p>the value im waiting for in the first listener is <code>yourid</code> . I also need that value to get a database reference to the node for the nested listener to be executed. But when i ran this code, both of them appear to be running at the same time. Hence, getting a null exception on the nested database reference, because the yourid appears to not have been retrieved at that time.</p>