title: Get Value from Firebase Database
body: <p>I need to get the string value from the node passcode in my Firebase database to compare with a user input, but unfortunately I am not able to get the value. This is the link to my firebase database in the below image.</p>
  
  <p><img src="https://i.stack.imgur.com/wlOcm.png" alt="Firebase Database screenshot"></p>
  
  <p>This is my codes below:</p>
  
  <pre><code> final DatabaseReference mDatabase = FirebaseDatabase.getInstance().getReference("pin_code");
  
          mDatabase.addListenerForSingleValueEvent(new com.google.firebase.database.ValueEventListener() {
              @Override
              public void onDataChange(com.google.firebase.database.DataSnapshot dataSnapshot) {
                  String rface = (String) dataSnapshot.child("pincode").getValue();
                  if (rface.equals(userPassword) &amp;&amp; !rface.equals("")){
                      Intent intent = new Intent(PinActivity.this, ProfileActivity.class);
                      startActivity(intent);
                  }
                  else {
                      if (rface.equals("") || rface.equals(null)){
                          // Creating new user node, which returns the unique key value
                          // new user node would be /users/$userid/
                          String userId = mDatabase.push().getKey();
  
                          // creating user object
                          Pin pin = new Pin(authUserId, userPassword);
  
                          mDatabase.child(userId).setValue(pin);
  
                          Intent intent = new Intent(PinActivity.this, ProfileActivity.class);
                          startActivity(intent);
                      }
                      else {
                          Toast.makeText(PinActivity.this,"Invalid PIN code", Toast.LENGTH_SHORT).show();
                          return;
                      }
  
                  }
              }
  
              @Override
              public void onCancelled(DatabaseError databaseError) {
              }
          });
  </code></pre>
  
  <p><strong>This is the json code</strong></p>
  
  <pre><code>  {
    "pin_code" : {
  "id" : "TQYTo1NHNnhPJnOxhe1Vok3U6ic2",
  "pincode" : "12345"
       }
    }
  </code></pre>