title: How to compare firebase inner child items in android without data object model?
body: <p><a href="https://i.stack.imgur.com/fBIMb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fBIMb.png" alt="enter image description here"></a></p>
  
  <p>I'm trying to validate the admin by taking text from the app. I've tried using a data object model and store the details but it is just not required. I've tried this code in other classes without the loop and it works fine.</p>
  
  <pre><code>databaseReference = FirebaseDatabase.getInstance().getReference("Preschools");
                          databaseReference.addListenerForSingleValueEvent(new ValueEventListener() {
                              @Override
                              public void onDataChange(DataSnapshot dataSnapshot) {
                                      for(DataSnapshot preschool : dataSnapshot.getChildren())
                                      {
                                          for(DataSnapshot admin : preschool.getChildren())
                                          {
                                                  String f_em = (String) admin.child("Admin").child("Email").getValue();
                                                  String f_pa = (String) admin.child("Admin").child("Password").getValue();
                                                  if(emailAddress.getText().toString().equals(f_em) &amp;&amp; password.getText().toString().equals(f_pa))
                                                  {
                                                      flag = true;
                                                  }
                                          }
                                      }
                                  }
                              @Override
                              public void onCancelled(DatabaseError databaseError) {
                                  Toast.makeText(_2_Login.this, "Unable to reach firebase", Toast.LENGTH_SHORT).show();
                              }
                          });
  </code></pre>
  
  <p>Logacat : <a href="https://i.stack.imgur.com/IDYO5.png" rel="nofollow noreferrer">Image Here</a></p>
  
  <p>False is returned in the if condition. I'm not able to figure out the error in my logic.</p>