syagbasan / android-maps-extensions

Automatically exported from code.google.com/p/android-maps-extensions
0 stars 1 forks source link

IndexOutOfBoundsException on marker visibility change. #23

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi

I've implemented your library(thanks :-D) but I need to filter my pins. 

It happened on recalculate() method in GridClusteringStrategy class 

Exactly, in line 268 there is this sentence:
List<DelegatingMarker> ms = cluster.getMarkersInternal();
DelegatingMarker first = ms.get(0);

Sometimes, ms is empty, so the exception is thrown, and so the app is closed.

So I added an extra line between those sentences, leaving it this way:

List<DelegatingMarker> ms = cluster.getMarkersInternal();
if(ms.isEmpty())continue;
DelegatingMarker first = ms.get(0);

Now it works fine, but I'm not sure if this is the best solution.

Thank you.

Original issue reported on code.google.com by tortipat...@gmail.com on 1 Jul 2013 at 9:03

GoogleCodeExporter commented 8 years ago
Hello,

Yes, that's fine. It is already fixed for the next release. See Issue 18.

I have fixed it the same way. The thing is sometimes you end up with empty 
cluster when markers are moved or hidden.

Original comment by maciek.g...@gmail.com on 1 Jul 2013 at 9:18