I've made this code for populate my map with infoWindows, that works well:
query.addValueEventListener(new ValueEventListener()
{
@Override
public void onDataChange(DataSnapshot dataSnapshots)
{
Marker marker;
for (DataSnapshot dataSnapshot : dataSnapshots.getChildren())
{
Location location = dataSnapshot.getValue(Location.class);
IdLocation.put(location,dataSnapshot.getKey());
marker = mgoogleMap.addMarker(new MarkerOptions()
.position(new LatLng(location.getLatitude(), location.getLongitude())) .title(getString(R.string.tipologia))
.icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_free)));
mapLocation.put(marker,location);
}
}
@Override
public void onCancelled(DatabaseError databaseError)
{
}
});
but I don't know if it works well also with 1M / 10M markers (my app needs to be scalable a lot). In this case, it's good to use HashMap or I have to use other things? The problem is also infoWindows that it is not accept any params...
Thank you