title: Firebase datasnapshot.getValue() returns null
body: <p>In my app, I have used Firebase database and stored userID in a child and set the value of the child as username to get the username of the current user. Now I'm using addValueEventListener to get the username from the database. This is my Firebase structure.<a href="https://i.stack.imgur.com/lnvzV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lnvzV.png" alt="Database Structure"></a>   </p>
  
  <p>The code is given below.</p>
  
  <pre><code>checkUsername.child("check").addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
                  currentUser = dataSnapshot.child(getUserID()).getValue(String.class);
                  Log.d(TAG, "onDataChange: currentUser = " + currentUser);
              }
  
              @Override
              public void onCancelled(DatabaseError databaseError) {
  
              }
          });
  </code></pre>
  
  <p>While debugging, <code>String currentUser</code> returns null.</p>
  
  <p>Screenshot of debugged answer.<a href="https://i.stack.imgur.com/T5wnz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/T5wnz.png" alt="Debugged Answer"></a></p>