title: Run a Firebase Realtime Database query multiple times using for loop in android not working
body: <p>I am trying to run a <strong>Firebase Realtime database query</strong> in for loop its not working. also not able to view data in <strong>RecyclerView</strong>.  kindly help me fix this issue. thanks in advance.</p>
  <pre><code>privte void mLoadData()
  {
  
      for(User user:nameArraylist)
              {
                  DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference();
                  Query query = databaseReference.child(&quot;AllUsers&quot;).child(user.getId()).limitToLast(1);
                  query.addValueEventListener(new ValueEventListener()
                  {
                      @Override
                      public void onDataChange(@NonNull DataSnapshot snapshot) {
                          for (DataSnapshot ds : snapshot.getChildren())
                          {
                              try {
                                  USerPojo userPojo = new USerPojo ();
                                  
                                  userPojo.setType(ds.child(&quot;type&quot;).getValue().toString());
                                  
      
                                  userArrayList.add(userPojo);
                              } catch (Exception e) {
                                  e.printStackTrace();
                              }
      
                          }
                      }
      
                      @Override
                      public void onCancelled(@NonNull DatabaseError error) {
      
                      }
      
      
                  });
      
              }
  
   
                  sAdapterNew = new AdapterNew(getActivity(), userArrayList);
                  groupRecyclerView.setAdapter(sAdapterNew );
                  sAdapterNew .notifyDataSetChanged();
     
  }
  </code></pre>