Hi I am trying to display some marker points on a Google map v2. All is good until I found this bug. For some reason if I load the map with 2 pointers on it and then close it and reload it again I get this message:
"IllegalStateException no included points"
This error appears when I call the:
LatLngBounds bounds = builder.build();
This is how I put the points on the map:
// Point the map's listeners at the listeners implemented by the cluster
// manager.
googleMap.setOnMarkerClickListener(mClusterManager);
builder = new LatLngBounds.Builder();
for (Ad ad : Constants._results)
{
builder.include(new LatLng(ad.getLat(), ad.getLon()));
}
googleMap.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() {
@Override
public void onCameraChange(CameraPosition cameraPosition)
{
int padding = 50; // offset from edges of the map in pixels
try{
LatLngBounds bounds = builder.build();
CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, padding);
googleMap.moveCamera(cu);
googleMap.setOnCameraChangeListener(mClusterManager);
}catch (Exception e)
{
e.printStackTrace();
}
}
});
Can anyone help out?
LogCat:
-30 14:11:11.267 20651-20874/com.myapp.user E/com.newrelic.agent.android﹕ Error in fireOnHarvestFinalize
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:806)
at java.util.HashMap$EntryIterator.next(HashMap.java:843)
at java.util.HashMap$EntryIterator.next(HashMap.java:841)
at com.newrelic.agent.android.metric.MetricStore.getAllByScope(MetricStore.java:63)
at com.newrelic.agent.android.metric.MetricStore.getAllUnscoped(MetricStore.java:74)
at com.newrelic.agent.android.harvest.HarvestDataValidator.ensureActivityNameMetricsExist(HarvestDataValidator.java:41)
at com.newrelic.agent.android.harvest.HarvestDataValidator.onHarvestFinalize(HarvestDataValidator.java:15)
at com.newrelic.agent.android.harvest.Harvester.fireOnHarvestFinalize(Harvester.java:580)
at com.newrelic.agent.android.harvest.Harvester.execute(Harvester.java:271)
at com.newrelic.agent.android.harvest.HarvestTimer.tick(HarvestTimer.java:73)
at com.newrelic.agent.android.harvest.HarvestTimer.tickIfReady(HarvestTimer.java:56)
at com.newrelic.agent.android.harvest.HarvestTimer.run(HarvestTimer.java:32)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:279)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:152)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
I think your problem lies here
Constants._results must be empty, so there are no LatLng points in your builder. Debug and check.
In the API, we find that :
In your code, the exception is launched when the list to compute the bounds is empty:
Run marker task on UI thread.