I want to show multiple markers on Google map. I want to show marker as number in round area. As below image :
For adding multiple markers i have gone through :
Adding multiple markers in Google Maps API v2 Android
Adding Multiple Markers Google Maps
How to show multiple markers on MapFragment in Google Map API v2?
And I have achieved multiple markers by this code :
public class ComplaintsMapActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
private NetworkManager networkManager = null;
private int reqIdComplaintList = -1;
private ArrayList<ComplaintData> complaintList = new ArrayList<>();
private static final int ZOOM_LEVEL = 15;
private static final int TILT_LEVEL = 0;
private static final int BEARING_LEVEL = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_complaints_map);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
networkManager = NetworkManager.getInstance();
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
complaintList = (ArrayList<ComplaintData>)getIntent().getSerializableExtra("list");
for (int i = 0; i < complaintList.size(); i++) {
ComplaintData location = complaintList.get(i);
LatLng position = new LatLng(Double.parseDouble(location.getLat()), Double.parseDouble(location.getLng()));
mMap.addMarker(new MarkerOptions().position(position));
if (i == 0) {
CameraPosition camPos = new CameraPosition(position, ZOOM_LEVEL, TILT_LEVEL, BEARING_LEVEL);
mMap.moveCamera(CameraUpdateFactory.newCameraPosition(camPos));
}
}
}
}
And my result is :
I know how to set custom markers. But this data is dynamic any number of data will be there. So I want to ask if is there any way to generate this numbers by any loop something. because setting marker to each location i would need hundreds of markers which is not much preferable. So is there any option for this?
Note : I don't want clustering. I just want to show 1 on one marker, 2 on second marker, ... and 100 on hundred marker and so on.
Any help will be appreciated.
Thank you :)