title: Getting data from firebase in array in Android
body: <p>I am new to Firebase. I have following data in firebase:
  <a href="https://i.stack.imgur.com/opPbc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/opPbc.png" alt="enter image description here"></a></p>
  
  <p>Inside EventPlayer I have array of data for key eventID. I want to get all objects for a eventID in an Array.</p>
  
  <p>My code:</p>
  
  <pre><code>final String eventId=intent.getStringExtra("EventID");
      mref.child("EventPlayer").child(eventId).orderByChild("eventID").equalTo(eventId);
      // Attach a listener to read the data at our posts reference
      mref.addValueEventListener(new ValueEventListener() {
          @Override
          public void onDataChange(DataSnapshot dataSnapshot) {
              for (DataSnapshot child : dataSnapshot.getChildren()) {
                  EventRequest post = child.getValue(EventRequest.class);
                  if(post != null){
                      System.out.println(post);
                      arrPlayers.add(post);
                  }
  
              }
          }
  
          @Override
          public void onCancelled(DatabaseError databaseError) {
              System.out.println("The read failed: " + databaseError.getCode());
          }
      });
  </code></pre>
  
  <p>The post has no value and it is an empty class.</p>
  
  <h2>Edit</h2>
  
  <p>Code for creating arrraylist:</p>
  
  <pre><code>arrPlayers = new ArrayList&lt;EventRequest&gt;();
  </code></pre>