title: Retrieve all Users id from Firebase Database
body: <p>I have save data of users to firebase database with hashmap.
  Users's data is ordered by their ID's.</p>
  
  <p>Saving code is:</p>
  
  <pre><code>emailauth = FirebaseAuth.getInstance();
      donorid= emailauth.getCurrentUser().getUid();
      mrefrnce= FirebaseDatabase.getInstance().getReference().child("Users").child("Donor").child(donorid);
  
      HashMap hmap= new HashMap();
      hmap.put("user_name",usern);
      hmap.put("bloodgroup",bld);
      hmap.put("user_address",address);
      hmap.put("user_type","Blood Donor");
      mrefrnce.updateChildren(hmap).addOnCompleteListener(new OnCompleteListener() {
          @Override
          public void onComplete(@NonNull Task task) {
              if(task.isSuccessful()){
                  Toast.makeText(MakeDonorProfile.this,"Data has been Saved",Toast.LENGTH_SHORT).show();
                  progress.dismiss();
                  Intent intent= new Intent(MakeDonorProfile.this, PlacePick.class);
                  startActivity(intent);
              }
          }
      });
  </code></pre>
  
  <p><strong>In the above code i have saved data by donor id</strong></p>
  
  <p>This is retrieving code</p>
  
  <pre><code>DatabaseReference donordRef = FirebaseDatabase.getInstance().getReference().child("Users").child("Donor");
  donordRef.addListenerForSingleValueEvent(new ValueEventListener() {
  
      @Override
      public void onDataChange(DataSnapshot dataSnapshot) {
          long size =  dataSnapshot.getChildrenCount();
          for (DataSnapshot child : dataSnapshot.getChildren()) {
              getDonorData donordata = dataSnapshot.getValue(getDonorData.class);
              String latitude = child.child("latitude").getValue().toString();
              String longitude = child.child("longitude").getValue().toString();
              String bloodgroup = child.child("bloodgroup").getValue().toString();
              String do_address = child.child("user_address").getValue().toString();
              String donarname = child.child("user_name").getValue().toString();
              double loclatitude = Double.parseDouble(latitude);
              double loclongitude = Double.parseDouble(longitude);
              LatLng  cod = new LatLng(loclatitude, loclongitude);
              mMap.addMarker(new MarkerOptions().position(cod).title( donarname).snippet("Blood Group:   "+bloodgroup+"\n"+"Address:   "+do_address));
              mMap.setInfoWindowAdapter(new InfoWindowAdapter(SearchActivity.this));
  
          }
  
  
      }
  
      @Override
      public void onCancelled(DatabaseError databaseError) {
  
      }
  
  
  });
  </code></pre>
  
  <p><strong>Now in retrieving code i want to get donor id with other data.</strong></p>
  
  <p>How I can get this id for all donors in DataSnapshot for loop?</p>
  
  <p>Database picture is <a href="https://i.stack.imgur.com/YAUaP.jpg" rel="nofollow noreferrer"> click database picture</a></p>
  
  <p><strong>Thanks in Advance</strong> </p>
  
  <p>Regards</p>
  
  <p><strong><em>Ahsan Sherazi</em></strong></p>