title: Android Firebase addListenerForSingleValueEvent is not working
body: <p>I know this has been asked a lot but I still can get it to work. Here's my code:</p>
  
  <pre><code>private int test;
  
  DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
  DatabaseReference userRef = rootRef.child("Users");
  
  test = 0;
  userRef.addListenerForSingleValueEvent(new ValueEventListener() {
     @Override
     public void onDataChange(DataSnapshot dataSnapshot) {
          if (dataSnapshot.hasChild(userID))
              test = 1;
          else
              test = 2;
     }
  
      @Override
      public void onCancelled(DatabaseError databaseError) {
  
      }
  });
  
  Log.d(TAG, "Test = " + test);
  </code></pre>
  
  <p>Here's what on Firebase:</p>
  
  <ul>
  <li>appname-e545e
  
  <ul>
  <li>Users
  
  <ul>
  <li>userID</li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>I don't know why but the variable "test" always return value 0, which means  addListenerForSingleValueEvent didn't work. Thanks for helping in advanced</p>