title: How to iterate through a Firebase structure in Android?
body: <p>I want to create a function that iterates through a firebase structure looking like this: </p>
  
  <pre><code>{
     "users":{
        "7e122736-2dd4-4770-a360-a0e7cbe41a43":{
           "currentLatitude":46.6598714,
           "currentLongitude":23.5637339,
           "displayName":"gjsj2",
           "email":"2@vlad.com",
           "password":"123"
        },
        "a09e7e1d-ad3a-4d21-b0ba-069e0999bb93":{
           "currentLatitude":47.6599014,
           "currentLongitude":23.5636797,
           "displayName":"gjsj",
           "email":"1@vlad.com",
           "password":"123"
        },
        "abc29286-fd6d-4088-95da-759828b5835d":{
           "currentLatitude":50.6599043,
           "currentLongitude":23525.5637188,
           "displayName":"gjsj3",
           "email":"3@vlad.com",
           "password":"123"
        }
     }
  }
  </code></pre>
  
  <p>I want to create a function that takes every unique user id's child and uses his coordinates to create a marker on a google maps map. Here's what i got so far but it doesnt seem to be working : </p>
  
  <pre><code>public void onChildChanged(DataSnapshot snapshot, String s) {
      for (DataSnapshot userSnapshot : snapshot.getChildren()) {
          for (DataSnapshot uniqueUserSnapshot : userSnapshot.getChildren()) {
              Users currentUser = uniqueUserSnapshot.getValue(Users.class);
  
              MarkerOptions options = new MarkerOptions()
                      .title(currentUser.getEmail())
                      .icon(BitmapDescriptorFactory.defaultMarker(getRandomNumberInRange(0, 360)))
                      .position(new LatLng(currentUser.getCurrentLatitude(), currentUser.getCurrentLongitude()));
              mMap.addMarker(options);
              Toast.makeText(MainActivity.this, "fsafasfasfas", Toast.LENGTH_SHORT).show();
          }
      }
  }
  </code></pre>
  
  <p>And here's my Users POJO: </p>
  
  <pre><code>package com.licenta.vladut.mmap;
  
  public class Users {
      String email;
      String displayName;
      String password;
      double currentLatitude;
      double currentLongitude;
  
  
      public Users() {
      }
  
      public Users(String email, String displayName, String password, double currentLongitude, double currentLatitude) {
          this.email = email;
          this.displayName = displayName;
          this.password = password;
          this.currentLongitude = currentLongitude;
          this.currentLatitude = currentLatitude;
      }
  
      public Users(String email, String displayName, String password) {
          this.email = email;
          this.displayName = displayName;
          this.password = password;
      }
  
      public String getDisplayName() {
          return displayName;
      }
  
      public String getEmail() {
          return email;
      }
  
      public String getPassword() {
          return password;
      }
  
      public double getCurrentLongitude() {
          return currentLongitude;
      }
  
      public double getCurrentLatitude() {
          return currentLatitude;
      }
  }
  </code></pre>